Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # FROM golang:1.21.3-alpine3.18 as builder
  2. # ENV GOPROXY https://goproxy.cn/
  3. # WORKDIR /go/release
  4. # COPY go.mod ./go.mod
  5. # RUN go mod tidy
  6. # COPY . .
  7. # RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o observe .
  8. FROM alpine:3.18
  9. RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
  10. RUN apk add --no-cache tzdata
  11. ENV TZ=Asia/Shanghai
  12. # COPY --from=builder /go/release/observe /app/observe
  13. # COPY --from=builder /go/release/config/settings.yml /app/settings.yml
  14. # COPY --from=builder /go/release/version /app/version
  15. COPY bin/observe /app/observe
  16. COPY ./config/settings.yml /app/settings.yml
  17. COPY ./version /app/version
  18. EXPOSE 8000
  19. RUN chmod +x /app/observe
  20. CMD ["/app/observe","server","-c", "/app/settings.yml"]
  21. # FROM golang:1.19.3
  22. # ENV GOPROXY https://goproxy.cn/
  23. # RUN apt install apt-transport-https ca-certificates
  24. # RUN apt-get update && apt-get install -yq tzdata vim iputils-ping net-tools telnet iotop
  25. # ENV TZ="Asia/Shanghai"
  26. # RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
  27. # RUN dpkg-reconfigure -f noninteractive tzdata
  28. # RUN mkdir -p /app
  29. # COPY bin/observe /app/observe
  30. # COPY ./config /app/config
  31. # COPY ./version /app/version
  32. # EXPOSE 8000
  33. # RUN chmod +x /app/observe
  34. # CMD ["/app/observe","server","-c", "/app/settings.yml"]