Dockerfile 2.2 KB

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