Dockerfile-with-nginx 992 B

123456789101112131415161718192021222324252627282930
  1. FROM golang:1.21 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 registry.cn-hangzhou.aliyuncs.com/tuon-pub/nginx:1.25.1
  10. RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  11. sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  12. apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
  13. RUN mkdir -p /app
  14. WORKDIR /app
  15. COPY --from=builder /app/app /app
  16. COPY conf /app/conf
  17. COPY data /app/data
  18. #COPY ../server/static /app/static
  19. COPY frontend/dist /app/static/web
  20. COPY docker/entrypoint.sh /entrypoint.sh
  21. RUN chmod +x /entrypoint.sh /app/app && rm -rf /app/static/web/config.js && \
  22. rm -rf /etc/nginx/conf.d
  23. ENTRYPOINT ["/entrypoint.sh"]