Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. FROM docker.io/alpine:3.19.1
  2. # https://git.alpinelinux.org/aports/log/main/gettext?h=3.19-stable
  3. ARG GETTEXT_PACKAGE_VERSION=0.22.3-r0
  4. # https://gitweb.torproject.org/tor.git/plain/ChangeLog
  5. # https://gitlab.torproject.org/tpo/core/tor/-/raw/release-0.4.8/ReleaseNotes
  6. # https://git.alpinelinux.org/aports/log/community/tor?h=3.19-stable
  7. ARG TOR_PACKAGE_VERSION=0.4.8.10-r0
  8. RUN apk add --no-cache \
  9. tor=$TOR_PACKAGE_VERSION \
  10. gettext-envsubst=$GETTEXT_PACKAGE_VERSION \
  11. && mkdir -m u=rwx,g=,o= /onion-service \
  12. && chown tor /onion-service
  13. VOLUME /var/lib/tor
  14. VOLUME /onion-service
  15. #RUN apk add --no-cache \
  16. # less \
  17. # man-db \
  18. # tor-doc=$TOR_PACKAGE_VERSION
  19. #ENV PAGER=less
  20. COPY torrc.template entrypoint.sh /
  21. RUN chmod -c a+rX /torrc.template /entrypoint.sh
  22. ENV VERSION 3
  23. ENV VIRTUAL_PORT 80
  24. ENV TARGET 1.2.3.4:8080
  25. ENV NON_ANONYMOUS_SINGLE_HOP_MODE 0
  26. ENTRYPOINT ["/entrypoint.sh"]
  27. USER tor
  28. CMD ["tor", "-f", "/tmp/torrc"]
  29. # https://gitweb.torproject.org/torspec.git/tree/control-spec.txt
  30. HEALTHCHECK CMD \
  31. printf "AUTHENTICATE\nGETINFO network-liveness\nQUIT\n" | nc localhost 9051 \
  32. | grep -q network-liveness=up || exit 1
  33. # https://github.com/opencontainers/image-spec/blob/v1.0.1/annotations.md
  34. ARG REVISION=
  35. LABEL org.opencontainers.image.title="tor onion service" \
  36. org.opencontainers.image.source="https://github.com/fphammerle/docker-onion-service" \
  37. org.opencontainers.image.revision="$REVISION"