You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
921 B
36 lines
921 B
# Utilise une image Python officielle |
|
FROM python:3.12-slim |
|
|
|
# Variables d'environnement |
|
ENV PYTHONDONTWRITEBYTECODE 1 |
|
ENV PYTHONUNBUFFERED 1 |
|
|
|
# Installer les dépendances système |
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
libpq-dev \ |
|
apache2 \ |
|
apache2-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
# Installer mod_wsgi |
|
RUN pip install mod_wsgi |
|
|
|
# Créer le dossier de l'application |
|
WORKDIR /code |
|
|
|
# Copier les fichiers de l'application |
|
COPY . /code/ |
|
|
|
# Installer les dépendances Python |
|
RUN pip install --upgrade pip |
|
RUN pip install -r requirements.txt |
|
|
|
# Collecte des fichiers statiques |
|
RUN python manage.py collectstatic --noinput |
|
|
|
# Exposer le port 8000 |
|
EXPOSE 8000 |
|
|
|
# Commande de lancement avec mod_wsgi-express (utilisation d'un utilisateur non-root) |
|
CMD mod_wsgi-express start-server --user www-data --group www-data --port 8000 --url-alias /static /code/static /code/ia_prof/wsgi.py |