Update and improve docker image

This commit updates the docker image to be based on Debian 10 Buster.
The startup script waits until the database container becomes available.
Needed dependencies for building the PostgreSQL driver were added to the
docker image.
This commit is contained in:
Jan Dittberner 2019-07-05 21:23:24 +02:00
parent e36a8baedf
commit 977189c263
2 changed files with 19 additions and 3 deletions

View file

@ -1,12 +1,14 @@
FROM debian:stretch
LABEL maintainer "Jan Dittberner <jan@dittberner.info>"
FROM debian:buster
LABEL maintainer="Jan Dittberner <jan@dittberner.info>"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
dumb-init \
gettext \
git \
libpq-dev \
postgresql-client \
python3-dev \
python3-pip \
&& apt-get clean \
@ -20,11 +22,12 @@ ENV LANG=C.UTF-8
RUN python3 -m pip install -U pip && pip3 install pipenv
COPY gnuviechadmin.sh /srv/
COPY Pipfile Pipfile.lock /srv/gnuviechadmin/
RUN pipenv install --system --deploy --ignore-pipfile --dev
COPY gnuviechadmin.sh /srv/
EXPOSE 8000
VOLUME /srv/gnuviechadmin

View file

@ -2,6 +2,19 @@
set -e
DB_HOST="${GVA_PGSQL_HOST:-db}"
DB_PORT="${GVA_PGSQL_PORT:-5432}"
DB_USER="${GVA_PGSQL_USER:-gnuviechadmin}"
DB_NAME="${GVA_PGSQL_DATABASE:-gnuviechadmin}"
until pg_isready -q -h "${DB_HOST}" -p "${DB_PORT}" -U "${PG_USER}" -d "${DB_NAME}"
do
echo -n "."
sleep 1
done
echo "db is ready"
python3 manage.py compilemessages
python3 manage.py collectstatic --noinput
python3 manage.py migrate --noinput