Build obfs4proxy from go package

This commit is contained in:
Aleksandr Beshkenadze 2023-12-02 19:58:14 +02:00
parent 0f48b9bd61
commit dc938d6f3a
No known key found for this signature in database

View file

@ -1,3 +1,21 @@
# Dockerfile for Tor Relay Server with obfs4proxy (Multi-Stage build)
FROM golang:alpine AS go-build
# Install Go for building obfs4proxy.
RUN apk --no-cache add --update go git ca-certificates
RUN mkdir -p /go/src /go/bin
RUN chmod -R 644 /go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
WORKDIR /go
# Build /go/bin/obfs4proxy & /go/bin/meek-server
RUN go install -v gitlab.com/yawning/obfs4.git/obfs4proxy@latest \
&& go install -v git.torproject.org/pluggable-transports/meek.git/meek-server@latest
# Copy the binaries to /usr/local/bin
RUN cp /go/bin/* /usr/local/bin/
FROM alpine:3.18
LABEL maintainer="Peter Dave Hello <hsu@peterdavehello.org>"
@ -7,12 +25,15 @@ LABEL version="latest"
RUN echo '@edge https://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
echo '@edge https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
apk -U upgrade && \
apk -v add tor@edge obfs4proxy@edge curl && \
apk -v add tor@edge curl && \
chmod 700 /var/lib/tor && \
rm -rf /var/cache/apk/* && \
tor --version
COPY --chown=tor:root torrc /etc/tor/
# Copy obfs4proxy & meek-server
COPY --from=go-build /usr/local/bin/ /usr/local/bin/
HEALTHCHECK --timeout=10s --start-period=60s \
CMD curl --fail --socks5-hostname localhost:9150 -I -L 'https://www.facebookwkhpilnemxj7asaniu7vnjjbiltxjqhye3mhbshg7kx5tfyd.onion/' || exit 1