Dockerfile 364 B

12345678910111213141516171819202122
  1. FROM golang:1.13-alpine AS builder
  2. LABEL stage=gobuilder
  3. ENV CGO_ENABLED 0
  4. ENV GOOS linux
  5. ENV GOPROXY https://goproxy.cn,direct
  6. WORKDIR $GOPATH/src/zero
  7. COPY . .
  8. RUN go build -ldflags="-s -w" -o /app/sub example/etcd/sub/sub.go
  9. FROM alpine
  10. RUN apk add --no-cache tzdata
  11. ENV TZ Asia/Shanghai
  12. WORKDIR /app
  13. COPY --from=builder /app/sub /app/sub
  14. CMD ["./sub"]