-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (53 loc) · 1.69 KB
/
Dockerfile
File metadata and controls
65 lines (53 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Interface Bacteria Dashboard - Docker Configuration
# Optimized for the new project structure
FROM python:3.11-slim-bookworm
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app \
# Streamlit configuration
STREAMLIT_SERVER_PORT=8501 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Set working directory
WORKDIR /app
# Install system dependencies required for geopandas, fiona, and other packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgdal-dev \
libgeos-dev \
libproj-dev \
gdal-bin \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Set GDAL environment variables
ENV GDAL_CONFIG=/usr/bin/gdal-config
# Copy requirements first for better cache utilization
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY app.py .
COPY dashboard/ ./dashboard/
COPY data/ ./data/
# Create Streamlit config directory and configuration
RUN mkdir -p ~/.streamlit
RUN echo '\
[server]\n\
port = 8501\n\
\n\
[theme]\n\
primaryColor = "#1f77b4"\n\
backgroundColor = "#ffffff"\n\
secondaryBackgroundColor = "#f0f2f6"\n\
textColor = "#262730"\n\
' > ~/.streamlit/config.toml
# Expose the Streamlit default port
EXPOSE 8501
# Health check - verify the app is running
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Run the Streamlit application
CMD ["streamlit", "run", "app.py"]