Dockerfile-full 656 B

123456789101112131415161718192021222324252627282930313233343536
  1. #first stage - builder
  2. FROM golang:latest as builder
  3. COPY . /app
  4. WORKDIR /app
  5. ENV GO111MODULE=auto
  6. RUN GOARCH=amd64 CGO_ENABLED=1 GOOS=linux go build -ldflags="-w -s" -o app main.go
  7. WORKDIR /app/netclient
  8. ENV GO111MODULE=auto
  9. RUN GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o netclient main.go
  10. #second stage
  11. FROM debian:latest
  12. RUN apt-get update && apt-get -y install systemd procps
  13. WORKDIR /root/
  14. COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
  15. COPY --from=builder /app .
  16. COPY --from=builder /app/config config
  17. COPY --from=builder /app/netclient netclient
  18. EXPOSE 8081
  19. EXPOSE 50051
  20. CMD ["./app"]