Dockerfile-netclient-full 1006 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. FROM gravitl/builder:latest as builder
  2. # add glib support daemon manager
  3. WORKDIR /app
  4. COPY . .
  5. ENV GO111MODULE=auto
  6. RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
  7. WORKDIR /root/
  8. RUN apk add --update git build-base libmnl-dev iptables
  9. RUN git clone https://git.zx2c4.com/wireguard-go && \
  10. cd wireguard-go && \
  11. make && \
  12. make install
  13. ENV WITH_WGQUICK=yes
  14. RUN git clone https://git.zx2c4.com/wireguard-tools && \
  15. cd wireguard-tools && \
  16. cd src && \
  17. make && \
  18. make install
  19. FROM alpine:3.13.6
  20. WORKDIR /root/
  21. RUN apk add --no-cache --update bash libmnl gcompat iptables openresolv iproute2
  22. COPY --from=builder /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
  23. COPY --from=builder /app/netclient-app ./netclient
  24. COPY --from=builder /app/scripts/netclient.sh .
  25. RUN chmod 0755 netclient && chmod 0755 netclient.sh
  26. ENV WG_QUICK_USERSPACE_IMPLEMENTATION=wireguard-go
  27. ENTRYPOINT ["/bin/sh", "./netclient.sh"]