Dockerfile 1.3 KB

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