From bdcd16b7e7933b26baf1c17d3b5ab9eaafcd6a33 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 3 Mar 2020 13:12:41 +0100 Subject: [PATCH] Unify docker setup with gvaweb and gva --- Dockerfile | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d8108a..ca70fd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ ARG DEBIAN_RELEASE=buster FROM debian:$DEBIAN_RELEASE LABEL maintainer="Jan Dittberner " -ARG GVALDAPGID=2000 -ARG GVALDAPUID=2000 +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ @@ -11,8 +11,6 @@ RUN apt-get update \ dumb-init \ gettext \ git \ - libldap2-dev \ - libsasl2-dev \ python3-dev \ python3-pip \ python3-setuptools \ @@ -21,25 +19,34 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*.* -WORKDIR /srv/gvaldap - -ENV LC_ALL=C.UTF-8 -ENV LANG=C.UTF-8 - RUN python3 -m pip install --prefix=/usr/local pipenv -COPY Pipfile Pipfile.lock /srv/gvaldap/ +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + libldap2-dev \ + libsasl2-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/*.* -RUN addgroup --gid $GVALDAPGID gvaldap ; \ - adduser --home /home/gvaldap --shell /bin/bash --uid $GVALDAPUID --gid $GVALDAPGID --disabled-password --gecos "Gnuviechadmin LDAP user" gvaldap +ARG GVAGID=2000 +ARG GVAUID=2000 -USER gvaldap -RUN python3 -m virtualenv --python=python3 /home/gvaldap/gvaldap-venv ; \ - /home/gvaldap/gvaldap-venv/bin/python3 -m pip install -U pip ; \ - VIRTUAL_ENV=/home/gvaldap/gvaldap-venv pipenv install --deploy --ignore-pipfile --dev +ARG GVAAPP=gvaldap -VOLUME /srv/gvaldap +WORKDIR /srv/$GVAAPP + +COPY Pipfile Pipfile.lock /srv/$GVAAPP/ + +RUN addgroup --gid $GVAGID $GVAAPP ; \ + adduser --home /home/$GVAAPP --shell /bin/bash --uid $GVAUID --gid $GVAGID --disabled-password --gecos "User for gnuviechadmin component $GVAAPP" $GVAAPP + +USER $GVAAPP +RUN python3 -m virtualenv --python=python3 /home/$GVAAPP/$GVAAPP-venv ; \ + /home/$GVAAPP/$GVAAPP-venv/bin/python3 -m pip install -U pip ; \ + VIRTUAL_ENV=/home/$GVAAPP/$GVAAPP-venv pipenv install --deploy --ignore-pipfile --dev + +VOLUME /srv/$GVAAPP COPY gvaldap.sh /srv/ -ENTRYPOINT ["dumb-init", "/srv/gvaldap.sh"] \ No newline at end of file +ENTRYPOINT ["dumb-init", "/srv/gvaldap.sh"]