Skip to content

Commit

Permalink
update: better structure
Browse files Browse the repository at this point in the history
  • Loading branch information
codekow committed Nov 4, 2023
1 parent e2c9452 commit 640da77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,32 @@ RUN apk add --update --no-cache \
xz-dev zstd-dev

# Install Tor from source
RUN git clone https://gitlab.torproject.org/tpo/core/tor.git --depth 1 --branch tor-$TOR_VERSION /tor
WORKDIR /tor
RUN ./autogen.sh
RUN git clone https://gitlab.torproject.org/tpo/core/tor.git --depth 1 --branch tor-"${TOR_VERSION}" /tor && \
./autogen.sh

# Notes:
# - --enable-gpl is required to compile PoW anti-DoS: https://community.torproject.org/onion-services/advanced/dos/
# --enable-static-tor
RUN ./configure \
--disable-asciidoc \
--disable-manpage \
--disable-html-manual \
--enable-gpl
# --enable-static-tor
RUN make
RUN make install
--enable-gpl && \
make && \
make install

# 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
RUN git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.git --depth 1 --branch $OBFS_VERSION /obfs
WORKDIR /obfs
RUN apk add --update --no-cache git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.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 \
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.obfs4
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
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
RUN git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.git --depth 1 --branch $OBFS_VERSION /obfs
RUN apk add --update --no-cache git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.git --depth 1 --branch $OBFS_VERSION /obfs

# Build obfs
RUN mkdir /out
Expand All @@ -16,6 +16,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM scratch
USER 1001
COPY --from=builder /tmp/passwd /etc/passwd
COPY --from=builder /out/obfs4proxy /
COPY --from=obfs-builder /tmp/passwd /etc/passwd
COPY --from=obfs-builder /out/obfs4proxy /
ENTRYPOINT ["/obfs4proxy"]
6 changes: 3 additions & 3 deletions Dockerfile.quick
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ARG TOR_VERSION="0.4.8.7"
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
RUN git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.git --depth 1 --branch $OBFS_VERSION /obfs
RUN apk add --update --no-cache git && \
git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/obfs4.git --depth 1 --branch $OBFS_VERSION /obfs

# Build obfs
RUN mkdir /out
Expand All @@ -25,7 +25,7 @@ LABEL \
WORKDIR /app

RUN apk add --update --no-cache \
tor=~${TOR_VERSION} && \
tor=~"${TOR_VERSION}" && \
chmod -R g+w /app /run

# install transports
Expand Down

0 comments on commit 640da77

Please sign in to comment.