Dockerfile 1.5 KB

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