diff --git a/Dockerfile b/Dockerfile index d7dc2f5..521754f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,9 +26,11 @@ COPY . . RUN python manage.py collectstatic --noinput 2>/dev/null || true -EXPOSE 8000 +ENV PORT=8000 + +EXPOSE ${PORT} HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ - CMD curl -f http://localhost:8000/health/ || exit 1 + CMD curl -f http://localhost:${PORT}/health/ || exit 1 -CMD ["gunicorn", "score.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "4", "--timeout", "120"] +CMD sh -c "gunicorn score.wsgi:application --bind 0.0.0.0:${PORT} --workers 4 --threads 4 --timeout 120" diff --git a/docker-compose.yml b/docker-compose.yml index 57cdf63..35a8dd0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,10 @@ services: web: build: . ports: - - "8000:8000" + - "${PORT:-8000}:${PORT:-8000}" env_file: .env environment: + - PORT=${PORT:-8000} - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_BROKER_BACKEND=redis volumes: