Dockerfile 534 B

123456789101112131415161718192021222324
  1. FROM golang:alpine AS builder
  2. LABEL stage=gobuilder
  3. ENV CGO_ENABLED 0
  4. ENV GOOS linux
  5. WORKDIR $GOPATH/src/zero
  6. COPY . .
  7. RUN go build -ldflags="-s -w" -o /app/gracefulrpc example/graceful/etcd/rpc/gracefulrpc.go
  8. FROM alpine
  9. RUN apk update --no-cache
  10. RUN apk add --no-cache ca-certificates
  11. RUN apk add --no-cache tzdata
  12. ENV TZ Asia/Shanghai
  13. WORKDIR /app
  14. COPY --from=builder /app/gracefulrpc /app/gracefulrpc
  15. COPY example/graceful/etcd/rpc/etc/graceful-rpc.json /app/etc/config.json
  16. CMD ["./gracefulrpc", "-f", "etc/config.json"]