Dockerfile 680 B

123456789101112131415161718192021222324252627282930
  1. FROM alpine:3.10
  2. ARG TOR_PACKAGE_VERSION=0.3.5.8-r0
  3. ARG NETCAT_PACKAGE_VERSION=1.130-r1
  4. RUN apk add --no-cache \
  5. netcat-openbsd=${NETCAT_PACKAGE_VERSION} \
  6. tor=${TOR_PACKAGE_VERSION} \
  7. && adduser -S onion \
  8. && mkdir -m u=rwx,g=,o= /onion-service \
  9. && chown onion /onion-service
  10. VOLUME /onion-service
  11. COPY torrc.template /
  12. RUN chmod a+r /torrc.template
  13. ENV VERSION 3
  14. ENV VIRTUAL_PORT 80
  15. ENV TARGET 1.2.3.4:8080
  16. COPY entrypoint.sh /
  17. RUN chmod a+rx /entrypoint.sh
  18. ENTRYPOINT ["/entrypoint.sh"]
  19. USER onion
  20. CMD ["tor", "-f", "/tmp/torrc"]
  21. HEALTHCHECK CMD \
  22. nc -x localhost:9050 -z "$(cat /onion-service/hostname)" "$VIRTUAL_PORT" \
  23. || exit 1