# Utiliser Python 3.9 comme base FROM python:3.9-slim # Installer poetry RUN pip install poetry # Create a non-root user RUN useradd -m -u 1000 appuser # Définir le répertoire de travail WORKDIR /app # Copier les fichiers de dépendances COPY poetry.lock pyproject.toml ./ COPY . . # Configurer poetry pour ne pas créer un environnement virtuel RUN poetry config virtualenvs.create false # Installer les dépendances sans installer le projet lui-même RUN poetry install --only main --no-interaction --no-ansi --no-root # Create static directory and set permissions RUN mkdir -p /app/server/static && \ chown -R appuser:appuser /app && \ # Verify the static files are present ls -la /app/server/static # Switch to non-root user USER appuser # Verify permissions after user switch RUN ls -la ~ && \ mkdir -p ~/static && \ ls -la ~/static # Exposer le port utilisé par Flask EXPOSE 7860 # Commande pour démarrer l'application CMD ["python", "-m", "server"]