12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- FROM golang:1.21 AS builder
- WORKDIR /app
- COPY . .
- ARG GOODS=linux
- ARG GOARCH=amd64
- RUN go env -w GOPROXY=https://goproxy.cn,direct
- RUN --mount=type=cache,target=/go --mount=type=cache,target=/root/.cache/go-build\
- GOODS=${GOODS} GOARCH=${GOARCH} go build -o /app/app app.go && \
- go build -o /app/agent agent.go
- FROM debian:sid-slim as nginxUI
- RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
- sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
- apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
- RUN mkdir -p /app/static/web
- WORKDIR /app
- COPY --from=builder /app/app .
- COPY --from=builder /app/agent .
- COPY conf /app/conf
- COPY data /app/data
- #COPY ../server/static /app/static
- COPY frontend/dist /app/static/web
- RUN chmod +x /app/app && rm -rf /app/static/web/config.js
- ENTRYPOINT ["/app/app"]
- # nginx-with-ui
- FROM registry.cn-hangzhou.aliyuncs.com/tuon-pub/nginx:1.25.1 as nginx
- RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
- sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
- apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
- RUN mkdir -p /app
- WORKDIR /app
- COPY --from=builder /app/app .
- COPY --from=builder /app/agent .
- COPY conf /app/conf
- COPY data /app/data
- #COPY ../server/static /app/static
- COPY frontend/dist /app/static/web
- COPY docker/entrypoint.sh /entrypoint.sh
- ENV TOKEN=""
- ENV SSL = "N"
- ENV SERVER_URL=""
- RUN chmod +x /entrypoint.sh /app/app && rm -rf /app/static/web/config.js && \
- rm -rf /etc/nginx/conf.d
- ENTRYPOINT ["/entrypoint.sh"]
|