FROM alpine:3.11 as download RUN apk add --no-cache git # https://github.com/mikecardwell/gpgit/compare/master...EtiennePerot:master ARG GPGIT_CLONE_URL=https://github.com/EtiennePerot/gpgit.git ARG GPGIT_REVISION=e9432412f2eb6aca77fb4e7bb6fad41fcbfd8632 RUN git clone "$GPGIT_CLONE_URL" /tmp/gpgit \ && cd /tmp/gpgit \ && git checkout "$GPGIT_REVISION" \ && ls -la FROM alpine:3.11 as service ARG CPANM_PACKAGE_VERSION=1.7044-r1 ARG GNUPG_PACKAGE_VERSION=2.2.19-r0 ARG PERL_MIME_TOOLS_PACKAGE_VERSION=5.509-r1 # potential alternatives: https://unix.stackexchange.com/a/315470/155174 ARG SOCAT_PACKAGE_VERSION=1.7.3.3-r1 ARG TINI_PACKAGE_VERSION=0.18.0-r0 ENV GNUPGHOME=/gnupg_home RUN apk add --no-cache \ gnupg=$GNUPG_PACKAGE_VERSION \ perl-app-cpanminus=$CPANM_PACKAGE_VERSION \ perl-class-tiny \ perl-list-moreutils \ perl-mime-tools=$PERL_MIME_TOOLS_PACKAGE_VERSION \ perl-moo \ perl-strictures \ perl-type-tiny \ socat=$SOCAT_PACKAGE_VERSION \ tini=$TINI_PACKAGE_VERSION \ && adduser -S gpgit \ && mkdir -p "$GNUPGHOME" \ && chown gpgit "$GNUPGHOME" \ && chmod 700 "$GNUPGHOME" VOLUME $GNUPGHOME ARG PERL_MAIL_GNUPG_VERSION=0.23 # Scalar-List-Utils-1.54 > libc-dev (sys/types.h) ARG PERL_MAIL_GNUPG_BUILD_PKGS="\ gcc \ libc-dev \ make \ perl-dev \ perl-module-build \ perl-scalar-list-utils \ perl-test-pod \ wget" RUN apk add --no-cache $PERL_MAIL_GNUPG_BUILD_PKGS \ && cpanm --notest Mail::GnuPG@$PERL_MAIL_GNUPG_VERSION \ && apk del $PERL_MAIL_GNUPG_BUILD_PKGS ARG GPGIT_PATH=/usr/local/bin/gpgit COPY --from=download /tmp/gpgit/gpgit $GPGIT_PATH ENV GNUPG_IMPORT="" COPY serve-gpgit.sh invoke-gpgit.sh / RUN chmod -c a+rx /serve-gpgit.sh /invoke-gpgit.sh USER gpgit # [string.ascii_lowercase.index(c) for c in 'gpgit'] ENTRYPOINT ["tini", "--"] EXPOSE 6156/tcp CMD ["/serve-gpgit.sh"]