File size: 847 Bytes
59d0b04 261137b cf396b5 59d0b04 |
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 |
# Use a lightweight Python image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the project files into the container
COPY . /app
# Install system dependencies for required Python packages
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Créer le répertoire `static` s'il n'existe pas
RUN mkdir -p /app/tmp
# Modifier les permissions pour autoriser l'écriture
RUN chmod -R 777 /app/tmp
# Ajouter un utilisateur non-root (facultatif)
RUN useradd -ms /bin/bash appuser
RUN chown -R appuser:appuser /app
# Passer à l'utilisateur non-root
USER appuser
# Expose the port used by Flask
EXPOSE 7860
# Command to start the application
CMD ["python", "app.py"] |