diff --git a/Dockerfile.prod b/Dockerfile.prod index 5b4f511..060f380 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -18,5 +18,9 @@ RUN apk add --no-cache --virtual .build-deps python3-dev build-base linux-header && pip install -r requirements.production.txt \ && apk del .build-deps -ENTRYPOINT ["sh", "-c", "echo 'Django running on http://localhost:8000 in production mode' \ - && gunicorn -w 4 -b 0.0.0.0:8000 sikweb.wsgi"] +RUN python manage.py collectstatic --noinput + +# run migrate +# python manage.py migrate --noinput + +ENTRYPOINT ["sh", "-c", "./production_entrypoint.sh"] diff --git a/production_entrypoint.sh b/production_entrypoint.sh new file mode 100644 index 0000000..bce7881 --- /dev/null +++ b/production_entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Collect static files +echo "Collect static files" +python manage.py collectstatic --noinput + +# Apply database migrations +echo "Apply database migrations" +python manage.py migrate + +# Start server +echo "Django running on http://localhost:8000 in production mode" +gunicorn -w 4 -b 0.0.0.0:8000 sikweb.wsgi \ No newline at end of file