1
0
mirror of https://github.com/daniviga/bite.git synced 2025-04-18 22:00:11 +02:00

Make Django migrations sync to DB availability

This commit is contained in:
Daniele Viganò 2020-06-17 20:06:51 +02:00
parent a587d70e83
commit 609c135acf
Signed by: dani
GPG Key ID: DB49AFC03C40EE02
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,9 @@ FROM python:3.8-alpine
ENV PYTHONUNBUFFERED 1
ENV DJANGO_SETTINGS_MODULE "beer.settings"
RUN apk update && apk add --no-cache postgresql-libs
RUN apk update && apk add --no-cache postgresql-libs \
&& wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-alpine-linux-amd64-v0.6.1.tar.gz -qO- \
| tar -xz -C /usr/local/bin
COPY --from=builder /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
COPY --chown=1000:1000 beer /srv/app/beer
COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt

View File

@ -75,9 +75,11 @@ services:
image: daniviga/beer
volumes:
- "../beer:/srv/app/beer"
command: ["python3", "manage.py", "migrate", "--noinput"]
command: ["dockerize", "-wait", "tcp://timescale:5432", "python3", "manage.py", "migrate", "--noinput"]
networks:
- net
depends_on:
- timescale
mqtt-to-db:
<<: *service_default