Dockerfile 657 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. RUN adduser -S onion
  8. RUN mkdir -m u=rwx,g=,o= /onion-service && chown onion /onion-service
  9. VOLUME /onion-service
  10. COPY torrc.template /
  11. RUN chmod a+r /torrc.template
  12. ENV VERSION 3
  13. ENV VIRTUAL_PORT 80
  14. ENV TARGET 1.2.3.4:8080
  15. COPY entrypoint.sh /
  16. RUN chmod a+rx /entrypoint.sh
  17. ENTRYPOINT ["/entrypoint.sh"]
  18. USER onion
  19. CMD ["tor", "-f", "/tmp/torrc"]
  20. HEALTHCHECK CMD \
  21. nc -x localhost:9050 -z "$(cat /onion-service/hostname)" "$VIRTUAL_PORT" \
  22. || exit 1