Dockerfile 1.2 KB

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