2021-11-17 11:18:24 +08:00
|
|
|
FROM gravitl/builder:latest as builder
|
|
|
|
# add glib support daemon manager
|
|
|
|
WORKDIR /app
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
COPY . .
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
ENV GO111MODULE=auto
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
WORKDIR /root/
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
RUN apk add --update git build-base libmnl-dev iptables
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
RUN git clone https://git.zx2c4.com/wireguard-go && \
|
|
|
|
cd wireguard-go && \
|
|
|
|
make && \
|
|
|
|
make install
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
ENV WITH_WGQUICK=yes
|
|
|
|
RUN git clone https://git.zx2c4.com/wireguard-tools && \
|
|
|
|
cd wireguard-tools && \
|
|
|
|
cd src && \
|
|
|
|
make && \
|
|
|
|
make install
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2022-03-28 21:49:21 +08:00
|
|
|
FROM alpine:3.15.2
|
2021-10-07 22:57:06 +08:00
|
|
|
|
|
|
|
WORKDIR /root/
|
|
|
|
|
2021-12-01 10:11:10 +08:00
|
|
|
RUN apk add --no-cache --update bash libmnl gcompat iptables openresolv iproute2
|
2021-11-17 11:18:24 +08:00
|
|
|
COPY --from=builder /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/
|
|
|
|
COPY --from=builder /app/netclient-app ./netclient
|
|
|
|
COPY --from=builder /app/scripts/netclient.sh .
|
|
|
|
RUN chmod 0755 netclient && chmod 0755 netclient.sh
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
ENV WG_QUICK_USERSPACE_IMPLEMENTATION=wireguard-go
|
2021-10-07 22:57:06 +08:00
|
|
|
|
2021-11-17 11:18:24 +08:00
|
|
|
ENTRYPOINT ["/bin/sh", "./netclient.sh"]
|