Dockerfile 1.4 KB

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