Newer
Older
# Stage 1: Build Python dependencies
FROM python:3.10-slim AS builder
WORKDIR /src/app
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Install Python in the second stage
# Install Python 3.11 in the final stage
RUN apt-get update && apt-get install -y \
python3-pip \
libgl1-mesa-glx \
libsm6 \
libxext6 \
ffmpeg \
curl \
wget \
git \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy Python dependencies from the builder stage
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
ENV PYTHONPATH=/root/.local/lib/python3.11/site-packages
# Copy the application files
COPY src/app /src/app
# Run the Flask app
CMD ["python3", "app.py"]