Skip to content

Instantly share code, notes, and snippets.

@toriato
Created June 14, 2025 11:05
Show Gist options
  • Save toriato/9d5fd134aa39345fb5fed6472a9e1095 to your computer and use it in GitHub Desktop.
Save toriato/9d5fd134aa39345fb5fed6472a9e1095 to your computer and use it in GitHub Desktop.
Containerfile for Tor
### stage 1
FROM docker.io/alpine:latest as builder
ENV TOR_VERSION="0.4.8.16"
RUN apk add build-base libevent-dev openssl-dev zlib-dev
RUN mkdir /src
RUN wget -O - "https://archive.torproject.org/tor-package-archive/tor-${TOR_VERSION}.tar.gz" |\
tar -C /src --strip-components 1 -xzf -
WORKDIR /src
RUN ./configure \
--prefix=/opt/tor \
--disable-system-torrc
RUN make -j$(nproc)
RUN make install
### stage 2
FROM docker.io/alpine:latest
RUN apk add --no-cache libevent openssl zlib
COPY --from=builder /opt/tor/bin/tor /usr/local/bin
RUN adduser -D -h /tor tor
WORKDIR /tor
USER tor
ENTRYPOINT [ "/usr/local/bin/tor" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment