Dockerfile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. FROM docker.io/debian:11.0-slim
  2. ARG GITOLITE_PACKAGE_VERSION=3.6.12-1
  3. ARG GIT_ANNEX_PACKAGE_VERSION=8.20210223-2
  4. ARG GIT_PACKAGE_VERSION=1:2.30.2-1
  5. ARG OPENSSH_SERVER_PACKAGE_VERSION=1:8.4p1-5
  6. ARG TINI_PACKAGE_VERSION=0.19.0-1
  7. ARG USER=git
  8. ARG GITOLITE_HOME_PATH=/var/lib/gitolite
  9. ENV SSHD_HOST_KEYS_DIR=/etc/ssh/host_keys
  10. RUN apt-get update \
  11. && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \
  12. git-annex=$GIT_ANNEX_PACKAGE_VERSION \
  13. git=$GIT_PACKAGE_VERSION \
  14. gitolite3=$GITOLITE_PACKAGE_VERSION \
  15. openssh-server=$OPENSSH_SERVER_PACKAGE_VERSION \
  16. tini=$TINI_PACKAGE_VERSION \
  17. && rm -rf /var/lib/apt/lists/* \
  18. && rm /etc/ssh/ssh_host_*_key* \
  19. && useradd --home-dir "$GITOLITE_HOME_PATH" --create-home "$USER" \
  20. && getent passwd "$USER" \
  21. && if grep --extended-regex --invert-match '^[a-z0-9_-]+:[\*!]:' /etc/shadow; then exit 1; fi \
  22. && mkdir "$SSHD_HOST_KEYS_DIR" \
  23. && chown -c "$USER" "$SSHD_HOST_KEYS_DIR"
  24. # TODO merge up
  25. RUN sed --in-place '/ENABLE => \[/a \\n '"'git-annex-shell ua'," \
  26. /usr/share/gitolite3/lib/Gitolite/Rc.pm
  27. VOLUME $GITOLITE_HOME_PATH
  28. VOLUME $SSHD_HOST_KEYS_DIR
  29. COPY sshd_config /etc/ssh/sshd_config
  30. EXPOSE 2200/tcp
  31. ENV GITOLITE_INITIAL_ADMIN_NAME=admin
  32. COPY entrypoint.sh /
  33. ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]
  34. USER $USER
  35. CMD ["/usr/sbin/sshd", "-D", "-e"]
  36. # https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
  37. ARG REVISION=
  38. LABEL org.opencontainers.image.title="gitolite with support for git-annex" \
  39. org.opencontainers.image.source="https://github.com/fphammerle/docker-gitolite" \
  40. org.opencontainers.image.revision="$REVISION"