Skip to content

Commit

Permalink
Run collectstatic as a background process for docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeacom committed Feb 1, 2018
1 parent 37479c0 commit e9a82b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ENV PYTHONUNBUFFERED 1
RUN mkdir /code && \
apt-get update && \
apt-get install -y --no-install-recommends gcc libc6-dev libc-dev libssl-dev make automake libtool autoconf pkg-config libffi-dev && \
pip3 install dumb-init && \
rm -rf /var/lib/apt/lists/*
WORKDIR /code
COPY requirements/base.txt /code/
Expand All @@ -11,3 +12,4 @@ RUN pip install -r test.txt
COPY requirements/dev.txt /code/
RUN pip install -r dev.txt && \
apt-get purge -y --auto-remove gcc libc6-dev libc-dev libssl-dev make automake libtool autoconf pkg-config libffi-dev
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
5 changes: 2 additions & 3 deletions bin/docker-command.bash
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash
#!/usr/local/bin/dumb-init /bin/bash

cd app
python manage.py createcachetable
python manage.py collectstatic --noinput -i other
python manage.py collectstatic --noinput -i other &
python manage.py migrate
python manage.py get_prices
python manage.py runserver 0.0.0.0:8000

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- PYTHONUNBUFFERED=1
- PYTHONPATH=/code/app
build: .
command: bash bin/docker-command.bash
command: ["bash", "bin/docker-command.bash"]
volumes:
- .:/code
ports:
Expand Down

0 comments on commit e9a82b3

Please sign in to comment.