File size: 603 Bytes
df66a57 0f524ec 2a70b45 0f524ec df66a57 0f524ec df66a57 9ea00c9 |
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 |
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create a user for running the app
RUN useradd -m -u 1000 user
RUN apt-get update && apt-get install -y ffmpeg wget git && apt-get clean
RUN mkdir -p /home/user && chown -R user:user /home/user
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV HOME=/home/user
# Copy app files
COPY . .
RUN chown -R user:user /app
# Switch to non-root user
USER user
# Expose the port the app runs on
EXPOSE 7860
CMD ["python", "flask_app.py", "--host", "0.0.0.0", "--port", "7860"]
|