Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +46 -14
Dockerfile
CHANGED
|
@@ -1,27 +1,59 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Set the working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
# Install
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Copy requirements
|
| 14 |
-
COPY requirements.txt .
|
| 15 |
-
COPY *.py ./
|
| 16 |
|
| 17 |
# Install Python dependencies
|
| 18 |
-
RUN
|
| 19 |
|
| 20 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
EXPOSE 8501
|
| 22 |
|
| 23 |
-
# Health check
|
| 24 |
-
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
gcc \
|
| 8 |
+
g++ \
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Copy requirements first for better caching
|
| 12 |
+
COPY requirements.txt .
|
|
|
|
| 13 |
|
| 14 |
# Install Python dependencies
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Copy application code
|
| 18 |
+
COPY . .
|
| 19 |
+
|
| 20 |
+
# Create .streamlit directory and config
|
| 21 |
+
RUN mkdir -p ~/.streamlit/
|
| 22 |
+
RUN echo "\
|
| 23 |
+
[general]\n\
|
| 24 |
+
email = \"\"\n\
|
| 25 |
+
" > ~/.streamlit/credentials.toml
|
| 26 |
+
|
| 27 |
+
RUN echo "\
|
| 28 |
+
[server]\n\
|
| 29 |
+
headless = true\n\
|
| 30 |
+
enableCORS=false\n\
|
| 31 |
+
port = 8501\n\
|
| 32 |
+
" > ~/.streamlit/config.toml
|
| 33 |
+
|
| 34 |
+
# Expose port
|
| 35 |
EXPOSE 8501
|
| 36 |
|
| 37 |
+
# Health check
|
| 38 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 39 |
+
|
| 40 |
+
# Run the application
|
| 41 |
+
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
|
| 42 |
+
|
| 43 |
+
# docker-compose.yml for easy deployment
|
| 44 |
+
version: '3.8'
|
| 45 |
|
| 46 |
+
services:
|
| 47 |
+
data-analysis-platform:
|
| 48 |
+
build: .
|
| 49 |
+
ports:
|
| 50 |
+
- "8501:8501"
|
| 51 |
+
environment:
|
| 52 |
+
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
| 53 |
+
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
| 54 |
+
volumes:
|
| 55 |
+
- ./data:/app/data
|
| 56 |
+
- ./exports:/app/exports
|
| 57 |
+
restart: unless-stopped
|
| 58 |
+
mem_limit: 2g
|
| 59 |
+
mem_reservation: 1g
|