Dockerfile-with-nginx 975 B

1234567891011121314151617181920212223242526272829
  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. WORKDIR /app
  14. COPY --from=builder /app/app /app
  15. COPY conf /app/conf
  16. COPY data /app/data
  17. #COPY ../server/static /app/static
  18. COPY frontend/dist /app/static/web
  19. COPY docker/entrypoint.sh /entrypoint.sh
  20. RUN chmod +x /entrypoint.sh /app/app && rm -rf /app/static/web/config.js && \
  21. rm -rf /etc/nginx/conf.d
  22. ENTRYPOINT ["/entrypoint.sh"]