Dockerfile 1.5 KB

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