Add entrypoint script with wait function for db.
This commit is contained in:
parent
cd8f6354fe
commit
8a792a17a6
@ -17,4 +17,10 @@ RUN pipenv install --skip-lock --system --dev
|
|||||||
# copy project
|
# copy project
|
||||||
COPY . /usr/src/app/
|
COPY . /usr/src/app/
|
||||||
|
|
||||||
|
# add wait for it
|
||||||
|
RUN git clone https://github.com/vishnubob/wait-for-it.git /wait-for-it
|
||||||
|
RUN chmod a+x /wait-for-it/wait-for-it.sh
|
||||||
|
|
||||||
|
# add entry point
|
||||||
|
ADD ./django-entrypoint.sh /django-entrypoint.sh
|
||||||
|
RUN chmod a+x /django-entrypoint.sh
|
||||||
|
6
app/django-entrypoint.sh
Normal file
6
app/django-entrypoint.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash -x
|
||||||
|
|
||||||
|
python manage.py collectstatic --noinput
|
||||||
|
python manage.py makemigrations --noinput
|
||||||
|
python manage.py migrate --noinput
|
||||||
|
exec "$@"
|
@ -3,7 +3,6 @@ version: '3.7'
|
|||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: ./app
|
build: ./app
|
||||||
command: gunicorn bundesdata_app.wsgi:application --bind 0.0.0.0:8000
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./app/:/usr/src/app/
|
- ./app/:/usr/src/app/
|
||||||
- ./input_volume/:/usr/src/app/input_data
|
- ./input_volume/:/usr/src/app/input_data
|
||||||
@ -12,12 +11,13 @@ services:
|
|||||||
- 8000
|
- 8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
command: bash -c "/wait-for-it/wait-for-it.sh db:5432 --strict --timeout=0 -- bash django-entrypoint.sh && gunicorn bundesdata_app.wsgi:application --bind 0.0.0.0:8000"
|
||||||
db:
|
db:
|
||||||
image: postgres:11.2
|
image: postgres:11.2
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=databaseUserName
|
- POSTGRES_USER=bundesdata_app_user
|
||||||
- POSTGRES_PASSWORD=totalSecurePassword
|
- POSTGRES_PASSWORD=v3ry53cr3t
|
||||||
- POSTGRES_DB=databaseName
|
- POSTGRES_DB=bundesdata_db
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres_data:/var/lib/postgresql/data/
|
- ./postgres_data:/var/lib/postgresql/data/
|
||||||
nginx:
|
nginx:
|
||||||
|
Loading…
Reference in New Issue
Block a user