2021-10-07 22:57:06 +08:00
|
|
|
FROM gravitl/builder:latest as builder
|
|
|
|
# add glib support daemon manager
|
|
|
|
WORKDIR /app
|
2021-07-16 03:14:48 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
COPY . .
|
2021-07-16 03:14:48 +08:00
|
|
|
|
|
|
|
ENV GO111MODULE=auto
|
|
|
|
|
2021-10-07 22:57:06 +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-07-16 03:14:48 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
FROM alpine:3.13.6
|
2021-07-16 03:14:48 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
RUN apk add gcompat iptables && mkdir -p /etc/netclient
|
|
|
|
# set the working directory
|
2021-07-16 03:14:48 +08:00
|
|
|
WORKDIR /root/
|
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
COPY --from=builder /app/netclient-app /etc/netclient/netclient
|
|
|
|
COPY --from=builder /app/scripts/netclient.sh .
|
2021-07-16 03:14:48 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
RUN chmod 0755 /etc/netclient/netclient && chmod 0755 netclient.sh
|
2021-07-16 03:14:48 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
ENTRYPOINT ["./netclient.sh"]
|