Dockerfile-netclient-doks-uspace 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. FROM debian:buster as builder
  2. # add glib support daemon manager
  3. RUN apt update -y && apt install -y wget bash gcc musl-dev openssl golang git build-essential libmnl-dev iptables
  4. RUN wget -O go.tgz https://dl.google.com/go/go1.17.1.linux-amd64.tar.gz
  5. RUN tar -C /usr/local -xzf go.tgz
  6. WORKDIR /usr/local/go/src
  7. RUN chmod +x make.bash
  8. RUN ./make.bash
  9. ENV PATH="/usr/local/go/bin:$PATH"
  10. ENV GOPATH=/opt/go/
  11. ENV PATH=$PATH:$GOPATH/bin
  12. WORKDIR /app
  13. COPY . .
  14. ENV GO111MODULE=auto
  15. RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
  16. WORKDIR /root/
  17. RUN git clone https://git.zx2c4.com/wireguard-go && \
  18. cd wireguard-go && \
  19. make && \
  20. make install
  21. ENV WITH_WGQUICK=yes
  22. RUN git clone https://git.zx2c4.com/wireguard-tools && \
  23. cd wireguard-tools && \
  24. cd src && \
  25. make && \
  26. make install
  27. FROM debian:buster
  28. WORKDIR /root/
  29. RUN apt update -y && apt install -y bash curl wget traceroute procps dnsutils iptables openresolv iproute2
  30. COPY --from=builder /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
  31. COPY --from=builder /app/netclient-app ./netclient
  32. COPY --from=builder /app/scripts/netclient.sh .
  33. RUN chmod 0755 netclient && chmod 0755 netclient.sh
  34. ENV WG_QUICK_USERSPACE_IMPLEMENTATION=wireguard-go
  35. ENTRYPOINT ["/bin/sh", "./netclient.sh"]