Dockerfile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. FROM alpine:3.11 as download
  2. RUN apk add --no-cache git
  3. # https://github.com/mikecardwell/gpgit/compare/master...EtiennePerot:master
  4. ARG GPGIT_CLONE_URL=https://github.com/EtiennePerot/gpgit.git
  5. ARG GPGIT_REVISION=e9432412f2eb6aca77fb4e7bb6fad41fcbfd8632
  6. RUN git clone "$GPGIT_CLONE_URL" /tmp/gpgit \
  7. && cd /tmp/gpgit \
  8. && git checkout "$GPGIT_REVISION" \
  9. && ls -la
  10. FROM alpine:3.11 as service
  11. ARG CPANM_PACKAGE_VERSION=1.7044-r1
  12. ARG GNUPG_PACKAGE_VERSION=2.2.19-r0
  13. ARG PERL_MIME_TOOLS_PACKAGE_VERSION=5.509-r1
  14. # potential alternatives: https://unix.stackexchange.com/a/315470/155174
  15. ARG SOCAT_PACKAGE_VERSION=1.7.3.3-r1
  16. ARG TINI_PACKAGE_VERSION=0.18.0-r0
  17. ENV GNUPGHOME=/gnupg_home
  18. RUN apk add --no-cache \
  19. gnupg=$GNUPG_PACKAGE_VERSION \
  20. perl-app-cpanminus=$CPANM_PACKAGE_VERSION \
  21. perl-class-tiny \
  22. perl-list-moreutils \
  23. perl-mime-tools=$PERL_MIME_TOOLS_PACKAGE_VERSION \
  24. perl-moo \
  25. perl-strictures \
  26. perl-type-tiny \
  27. socat=$SOCAT_PACKAGE_VERSION \
  28. tini=$TINI_PACKAGE_VERSION \
  29. && adduser -S gpgit \
  30. && mkdir -p "$GNUPGHOME" \
  31. && chown gpgit "$GNUPGHOME" \
  32. && chmod 700 "$GNUPGHOME"
  33. VOLUME $GNUPGHOME
  34. ARG PERL_MAIL_GNUPG_VERSION=0.23
  35. # Scalar-List-Utils-1.54 > libc-dev (sys/types.h)
  36. ARG PERL_MAIL_GNUPG_BUILD_PKGS="\
  37. gcc \
  38. libc-dev \
  39. make \
  40. perl-dev \
  41. perl-module-build \
  42. perl-scalar-list-utils \
  43. perl-test-pod \
  44. wget"
  45. RUN apk add --no-cache $PERL_MAIL_GNUPG_BUILD_PKGS \
  46. && cpanm --notest Mail::GnuPG@$PERL_MAIL_GNUPG_VERSION \
  47. && apk del $PERL_MAIL_GNUPG_BUILD_PKGS
  48. ARG GPGIT_PATH=/usr/local/bin/gpgit
  49. COPY --from=download /tmp/gpgit/gpgit $GPGIT_PATH
  50. ENV GNUPG_IMPORT=""
  51. COPY serve-gpgit.sh invoke-gpgit.sh /
  52. RUN chmod -c a+rx /serve-gpgit.sh /invoke-gpgit.sh
  53. USER gpgit
  54. # [string.ascii_lowercase.index(c) for c in 'gpgit']
  55. ENTRYPOINT ["tini", "--"]
  56. EXPOSE 6156/tcp
  57. CMD ["/serve-gpgit.sh"]