Skip to content

Commit

Permalink
move migration and static files creation to build time
Browse files Browse the repository at this point in the history
  • Loading branch information
remcoros committed Jul 21, 2024
1 parent 815df39 commit 05181ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ RUN \
# add Labelbase
COPY assets/nginx.conf /etc/nginx/sites-available/default
COPY ./Labelbase/django /app

# create migrations and static files, working around issues with manage.py of Labelbase
# need to run 'manage.py help' to create a /app/config.ini first
RUN \
MYSQL_PASSWORD=not_used python manage.py help && \
python manage.py makemigrations --noinput && \
python manage.py collectstatic --noinput && \
rm /app/config.ini

COPY ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
2 changes: 0 additions & 2 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ else
cp /app/config.ini /root/data
fi

python manage.py makemigrations --noinput
python manage.py migrate --noinput
python manage.py collectstatic --noinput
python manage.py process_tasks &
gunicorn labellabor.wsgi:application -b 127.0.0.1:8000 --reload &
app_process=$!
Expand Down

0 comments on commit 05181ec

Please sign in to comment.