Dockerfile 573 B

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