From 628d6ee550412565893c24d9860140bb651d6e47 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 3 Mar 2020 12:22:45 +0100 Subject: [PATCH] Add Dockerfile and entrypoint script --- Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++++++++ gvaldap.sh | 7 +++++++ 2 files changed, 52 insertions(+) create mode 100644 Dockerfile create mode 100755 gvaldap.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d8108a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +ARG DEBIAN_RELEASE=buster +FROM debian:$DEBIAN_RELEASE +LABEL maintainer="Jan Dittberner " + +ARG GVALDAPGID=2000 +ARG GVALDAPUID=2000 + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + build-essential \ + dumb-init \ + gettext \ + git \ + libldap2-dev \ + libsasl2-dev \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-virtualenv \ + python3-wheel \ + && 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 addgroup --gid $GVALDAPGID gvaldap ; \ + adduser --home /home/gvaldap --shell /bin/bash --uid $GVALDAPUID --gid $GVALDAPGID --disabled-password --gecos "Gnuviechadmin LDAP user" gvaldap + +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 + +VOLUME /srv/gvaldap + +COPY gvaldap.sh /srv/ + +ENTRYPOINT ["dumb-init", "/srv/gvaldap.sh"] \ No newline at end of file diff --git a/gvaldap.sh b/gvaldap.sh new file mode 100755 index 0000000..73eab77 --- /dev/null +++ b/gvaldap.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +. /home/gvaldap/gvaldap-venv/bin/activate +cd /srv/gvaldap/gvaldap +celery -A ldaptasks worker -Q ldap -l info