Dockerfile-with-nginx 917 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:1.20 AS builder
  2. WORKDIR /app
  3. COPY . .
  4. ARG GOODS=linux
  5. ARG GOARCH=amd64
  6. RUN go env -w GOPROXY=https://goproxy.cn,direct
  7. RUN --mount=type=cache,target=/go --mount=type=cache,target=/root/.cache/go-build \
  8. GOODS=${GOODS} GOARCH=${GOARCH} go build -o /app/app app.go
  9. FROM nginx:1.25.1
  10. WORKDIR /app
  11. COPY --from=builder /app/app /app
  12. COPY conf /app/conf
  13. COPY data /app/data
  14. #COPY ../server/static /app/static
  15. COPY frontend/dist /app/static/web
  16. COPY docker/entrypoint.sh /entrypoint.sh
  17. RUN chmod +x /entrypoint.sh /app/app
  18. RUN rm -rf /app/static/web/config.js
  19. RUN rm -rf /etc/nginx/conf.d
  20. RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
  21. RUN sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
  22. RUN apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
  23. ENTRYPOINT ["/entrypoint.sh"]