Skip to content
Snippets Groups Projects
Commit 8dd38463 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

wait for DB script

parent 616cb16f
No related branches found
No related tags found
1 merge request!2Dev
...@@ -10,12 +10,18 @@ ENV PYTHONUNBUFFERED 1 ...@@ -10,12 +10,18 @@ ENV PYTHONUNBUFFERED 1
# install dependencies # install dependencies
RUN apt-get -y update RUN apt-get -y update
RUN apt-get install -y python python-pip python-dev python-django-extensions postgresql-client RUN apt-get install -y python python-pip python-dev python-django-extensions postgresql-client netcat
RUN pip install --upgrade pip RUN pip install --upgrade pip
COPY ./requirements/production.txt /usr/src/app/requirements.txt COPY ./requirements/production.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
RUN apt-get -y update && apt-get -y autoremove RUN apt-get -y update && apt-get -y autoremove
# copy entrypoint.sh
COPY ./src/entrypoint.sh /usr/src/app/entrypoint.sh
# copy project # copy project
COPY ./src /usr/src/app/ COPY ./src /usr/src/app/
\ No newline at end of file
# run entrypoint.sh
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
\ No newline at end of file
#!/bin/sh
if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
while ! nc -z $DB_HOST $DB_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
python manage.py flush --no-input
python manage.py migrate
exec "$@"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment