Dockerfile 1.2 KB

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