fix(dockefile)
This commit is contained in:
@@ -42,17 +42,9 @@ COPY . .
|
|||||||
|
|
||||||
# Permissions
|
# Permissions
|
||||||
RUN chmod -R 755 /app
|
RUN chmod -R 755 /app
|
||||||
|
RUN chmod +x entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Hot-reload + respect des en-têtes proxy (utile si tu testes derrière Traefik en dev)
|
# Lancer les migrations puis démarrer l'application
|
||||||
# Astuce: on exclut uploads/logs du reload pour éviter les restarts inutiles
|
CMD ["./entrypoint.sh"]
|
||||||
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=*"]
|
|
||||||
|
|||||||
30
backend/entrypoint.sh
Normal file
30
backend/entrypoint.sh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Running database migrations..."
|
||||||
|
alembic upgrade head
|
||||||
|
|
||||||
|
echo "Starting application..."
|
||||||
|
|
||||||
|
# Détecter l'environnement (production ou développement)
|
||||||
|
if [ "$ENVIRONMENT" = "production" ]; then
|
||||||
|
echo "Running in production mode..."
|
||||||
|
exec uvicorn app:app \
|
||||||
|
--host 0.0.0.0 \
|
||||||
|
--port 8000 \
|
||||||
|
--log-level info \
|
||||||
|
--proxy-headers \
|
||||||
|
--forwarded-allow-ips=*
|
||||||
|
else
|
||||||
|
echo "Running in development mode..."
|
||||||
|
exec 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=*
|
||||||
|
fi
|
||||||
|
|
||||||
Reference in New Issue
Block a user