working version
This commit is contained in:
61
backend/Dockerfile.dev
Executable file
61
backend/Dockerfile.dev
Executable file
@@ -0,0 +1,61 @@
|
||||
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 . .
|
||||
|
||||
# Env dev
|
||||
COPY .env.development .env
|
||||
|
||||
# Permissions
|
||||
RUN chmod -R 755 /app
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Hot-reload + respect des en-têtes proxy (utile si tu testes derrière Traefik en dev)
|
||||
# Astuce: on exclut uploads/logs du reload pour éviter les restarts inutiles
|
||||
CMD ["uvicorn", "app:app", \
|
||||
"--reload", \
|
||||
"--reload-exclude", "uploads/*", \
|
||||
"--reload-exclude", "logs/*", \
|
||||
"--host", "0.0.0.0", \
|
||||
"--port", "8000", \
|
||||
"--log-level", "debug", \
|
||||
"--proxy-headers", \
|
||||
"--forwarded-allow-ips=*"]
|
||||
Reference in New Issue
Block a user