-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.streamlit
More file actions
36 lines (26 loc) · 1.19 KB
/
Dockerfile.streamlit
File metadata and controls
36 lines (26 loc) · 1.19 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
# Dockerfile.streamlit
# Having Separate Dockerfiles for UI and FastAPI avoids mixing UI logic with backend logic.
# makes builds work across different architectures (
FROM --platform=$BUILDPLATFORM python:3.11-slim
ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
WORKDIR /app
# Install uv and project deps (from pyproject.toml)
COPY pyproject.toml uv.lock* ./
RUN pip install --no-cache-dir uv \
&& uv pip install --system .
# Copy the app (and data needed by the app)
COPY . .
# Streamlit config
ENV STREAMLIT_SERVER_PORT=8501 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_BASEURLPATH=/dashboard \
STREAMLIT_BROWSER_GATHERUSAGESTATS=false
# Default API_URL (override in docker run / ECS)
ENV API_URL=http://localhost:8000/predict
EXPOSE 8501
# Make absolutely sure Streamlit is the thing that starts
ENTRYPOINT ["streamlit", "run", "app.py"]
CMD ["--server.port=8501", "--server.address=0.0.0.0", "--server.baseUrlPath=/dashboard"]
# FastAPI container: lightweight, only needs Python + Uvicorn + your code.
# Streamlit container: interactive web app, needs Streamlit configuration and a link to the API.
# Streamlit has more ENV config because it’s UI-focused. FastAPI just runs a server.