-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.quick
45 lines (33 loc) · 1.36 KB
/
Dockerfile.quick
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ARG ALPINE_VERSION="3.18.4"
# Build the obfs4 binary (cross-compiling)
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as obfs-builder
ARG OBFS_VERSION="obfs4proxy-0.0.14-tor2"
RUN apk add --update --no-cache git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/lyrebird.git --depth 1 --branch "${OBFS_VERSION}" /obfs
# Build obfs
RUN mkdir /out
WORKDIR /obfs
ARG TARGETOS TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/obfs4proxy ./obfs4proxy
# Tor runner
FROM --platform=$TARGETPLATFORM docker.io/library/alpine:${ALPINE_VERSION} as runner
LABEL \
org.opencontainers.image.source "https://github.com/bugfest/tor-docker"
WORKDIR /app
ENV HOME=/app
ARG TOR_VERSION="0.4.8.9"
RUN apk add --update --no-cache \
tor=~"${TOR_VERSION}" && \
chmod -R g+w /app /run
# fix hard coded path for controller
RUN ln -s /usr/bin/tor /usr/local/bin/tor
# install transports
COPY --from=obfs-builder /out/obfs4proxy /usr/local/bin/.
# create service dir (we don't define VOLUME because https://github.com/docker-library/mysql/issues/255
# and other issues when running as non-root user)
RUN mkdir -p /run/tor/service && chown -R 1001 /run/tor
# change to non root
USER 1001
ENTRYPOINT ["/usr/local/bin/tor"]