Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. FROM docker.io/alpine:3.18.4
  2. # https://www.borgbackup.org/releases/
  3. # https://git.alpinelinux.org/aports/log/community/borgbackup?h=3.18-stable
  4. ARG BORGBACKUP_PACKAGE_VERSION=1.2.6-r0
  5. # https://www.openssh.com/releasenotes.html
  6. # https://git.alpinelinux.org/aports/log/main/openssh?h=3.18-stable
  7. ARG OPENSSH_SERVER_PACKAGE_VERSION=9.3_p2-r0
  8. ARG TINI_PACKAGE_VERSION=0.19.0-r1
  9. ARG USER=borg
  10. ENV SSHD_HOST_KEYS_DIR=/etc/ssh/host_keys
  11. ENV REPO_PATH=/repository
  12. RUN apk add --no-cache \
  13. borgbackup="$BORGBACKUP_PACKAGE_VERSION" \
  14. openssh-server="$OPENSSH_SERVER_PACKAGE_VERSION" \
  15. tini=$TINI_PACKAGE_VERSION \
  16. && adduser -S -s /bin/ash "$USER" \
  17. && mkdir "$SSHD_HOST_KEYS_DIR" \
  18. && chown -c "$USER" "$SSHD_HOST_KEYS_DIR" \
  19. && mkdir "$REPO_PATH" \
  20. && chown -c "$USER" "$REPO_PATH"
  21. VOLUME $SSHD_HOST_KEYS_DIR
  22. VOLUME $REPO_PATH
  23. COPY sshd_config /etc/ssh/sshd_config
  24. EXPOSE 2200/tcp
  25. ENV SSH_CLIENT_PUBLIC_KEYS=
  26. ENV SSH_CLIENT_PUBLIC_KEYS_APPEND_ONLY=
  27. COPY entrypoint.sh /
  28. ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
  29. USER $USER
  30. CMD ["/usr/sbin/sshd", "-D", "-e"]
  31. # https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
  32. ARG REVISION=
  33. LABEL org.opencontainers.image.title="single-user openssh server restricted to borgbackup backend" \
  34. org.opencontainers.image.source="https://github.com/fphammerle/docker-borgbackup-sshd" \
  35. org.opencontainers.image.revision="$REVISION"