-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.39 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (35 loc) · 1.39 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
# ---- Build stage: install dependencies in a clean layer ----
FROM python:3.11-slim AS builder
WORKDIR /build
# Install only the build-time system deps
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc g++ && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
# Install CPU-only PyTorch first (saves ~1.5 GB vs full CUDA build),
# then the rest of the requirements.
RUN pip install --no-cache-dir --prefix=/install \
torch --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir --prefix=/install \
-r requirements.txt
# ---- Runtime stage ----
FROM python:3.11-slim
LABEL maintainer="PyDimension Team"
LABEL description="PyDimension: data-driven discovery of dimensionless numbers and symmetries"
WORKDIR /app
# Copy installed Python packages from builder
COPY --from=builder /install /usr/local
# Copy project source
COPY . .
# Install the package itself (editable so scripts at repo root still work)
RUN pip install --no-cache-dir -e .
# Streamlit config: disable telemetry, bind to 0.0.0.0
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_PORT=8501 \
PYTHONUNBUFFERED=1 \
MPLBACKEND=Agg
EXPOSE 8501
# Default: launch the Streamlit web app.
# Override with e.g. docker run pydimension python run_pipeline.py --help
CMD ["streamlit", "run", "streamlit_app.py"]