2021-03-26 00:17:52 +08:00
|
|
|
#first stage - builder
|
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
FROM golang:latest as builder
|
2021-03-26 00:17:52 +08:00
|
|
|
|
|
|
|
COPY . /app
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ENV GO111MODULE=auto
|
|
|
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o app main.go
|
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
WORKDIR /app/netclient
|
|
|
|
|
|
|
|
ENV GO111MODULE=auto
|
|
|
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o netclient main.go
|
2021-03-26 00:17:52 +08:00
|
|
|
|
|
|
|
#second stage
|
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
FROM debian:latest
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
RUN apt-get update && apt-get -y install systemd procps
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
WORKDIR /root/
|
2021-03-26 00:17:52 +08:00
|
|
|
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
|
|
|
|
COPY --from=builder /app .
|
|
|
|
COPY --from=builder /app/config config
|
2021-05-05 05:36:55 +08:00
|
|
|
COPY --from=builder /app/netclient netclient
|
2021-03-26 00:17:52 +08:00
|
|
|
|
|
|
|
EXPOSE 8081
|
|
|
|
EXPOSE 50051
|
|
|
|
|
2021-05-05 05:36:55 +08:00
|
|
|
CMD ["./app"]
|