Dockerfile 2.1 KB

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