2021-03-26 00:17:52 +08:00
|
|
|
#first stage - builder
|
2021-10-07 22:57:06 +08:00
|
|
|
FROM gravitl/builder as builder
|
2021-03-26 00:17:52 +08:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
COPY . .
|
2021-05-05 05:36:55 +08:00
|
|
|
|
|
|
|
ENV GO111MODULE=auto
|
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=1 /usr/local/go/bin/go build -ldflags="-w -s" -o netmaker main.go
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
FROM alpine:3.13.6
|
|
|
|
# add a c lib
|
|
|
|
RUN apk add gcompat iptables
|
|
|
|
# set the working directory
|
2021-05-05 05:36:55 +08:00
|
|
|
WORKDIR /root/
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
RUN mkdir -p /etc/netclient/config
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
COPY --from=builder /app/netmaker .
|
2021-03-26 00:17:52 +08:00
|
|
|
COPY --from=builder /app/config config
|
|
|
|
|
|
|
|
EXPOSE 8081
|
|
|
|
EXPOSE 50051
|
|
|
|
|
2021-10-07 22:57:06 +08:00
|
|
|
ENTRYPOINT ["./netmaker"]
|