File size: 973 Bytes
f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 3d41682 f733690 |
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 |
# syntax=docker/dockerfile:1
FROM python:3.10-slim
# Prevent Python from buffering stdout/stderr (better logs)
ENV PYTHONUNBUFFERED=1
WORKDIR /home/user/app
# System dependencies (minimal), and Git LFS
RUN apt-get update && \
apt-get install -y --no-install-recommends git git-lfs ffmpeg libsm6 libxext6 libgl1-mesa-glx && \
rm -rf /var/lib/apt/lists/* && \
git lfs install
# Upgrade pip/setuptools
RUN pip install --no-cache-dir pip setuptools
# Copy requirements early to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application source
COPY . .
# Expose both common ports (Flask uses 8080, Streamlit uses 8501)
EXPOSE 8080 8501
# Entrypoint: choose Streamlit if USE_STREAMLIT=1, otherwise run Flask app
CMD if [ "$USE_STREAMLIT" = "1" ]; then \
streamlit run app.py --server.port=8501 --server.enableCORS=false; \
else \
python app.py; \
fi
|