Dockerfile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. go build -o /app/agent agent.go
  10. FROM debian:sid-slim as nginxUI
  11. RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  12. sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  13. apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
  14. RUN mkdir -p /app/static/web
  15. WORKDIR /app
  16. COPY --from=builder /app/app .
  17. COPY --from=builder /app/agent .
  18. COPY conf /app/conf
  19. COPY data /app/data
  20. #COPY ../server/static /app/static
  21. COPY frontend/dist /app/static/web
  22. RUN chmod +x /app/app && rm -rf /app/static/web/config.js
  23. ENTRYPOINT ["/app/app"]
  24. # nginx-with-ui
  25. FROM registry.cn-hangzhou.aliyuncs.com/tuon-pub/nginx:1.25.1 as nginx
  26. RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  27. sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
  28. apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
  29. RUN mkdir -p /app
  30. WORKDIR /app
  31. COPY --from=builder /app/app .
  32. COPY --from=builder /app/agent .
  33. COPY conf /app/conf
  34. COPY data /app/data
  35. #COPY ../server/static /app/static
  36. COPY frontend/dist /app/static/web
  37. COPY docker/entrypoint.sh /entrypoint.sh
  38. ENV TOKEN=""
  39. ENV SSL = "N"
  40. ENV SERVER_URL=""
  41. RUN chmod +x /entrypoint.sh /app/app && rm -rf /app/static/web/config.js && \
  42. rm -rf /etc/nginx/conf.d
  43. ENTRYPOINT ["/entrypoint.sh"]