File size: 694 Bytes
2782cfd |
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 |
# Use official Python slim image
FROM python:3.12.4-slim
# Create and use non-root user later
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
libsm6 \
libxext6 \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create user and switch context
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Install Python packages
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy source code
COPY --chown=user . /app
# Start with Gunicorn (adjust port or app path if needed)
CMD ["gunicorn", "-b", "0.0.0.0:7860", "main:app"]
|