Dockerfile 571 B

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