51 lines
1.1 KiB
Docker
51 lines
1.1 KiB
Docker
FROM python:3.11-slim
|
|
|
|
LABEL maintainer="LeDiscord Team"
|
|
LABEL version="1.0"
|
|
LABEL description="LeDiscord Backend - Environnement Développement"
|
|
|
|
WORKDIR /app
|
|
|
|
# Env dev
|
|
ENV ENVIRONMENT=development \
|
|
PYTHONPATH=/app \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Dépendances système (minifiées)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
libpq-dev \
|
|
libmagic1 \
|
|
libgl1 \
|
|
libglib2.0-0 \
|
|
libsm6 \
|
|
libxext6 \
|
|
libxrender1 \
|
|
libgomp1 \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Requirements (cache friendly)
|
|
COPY requirements.txt .
|
|
|
|
# Uvicorn[standard] apporte watchfiles pour un --reload rapide/stable en dev
|
|
RUN pip install --no-cache-dir --upgrade pip \
|
|
&& pip install --no-cache-dir -r requirements.txt \
|
|
&& pip install --no-cache-dir "uvicorn[standard]"
|
|
|
|
# Dossiers utiles
|
|
RUN mkdir -p /app/uploads /app/logs
|
|
|
|
# Code source
|
|
COPY . .
|
|
|
|
# Permissions
|
|
RUN chmod -R 755 /app
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
EXPOSE 8000
|
|
|
|
# Lancer les migrations puis démarrer l'application
|
|
CMD ["./entrypoint.sh"]
|