| @@ -1,4 +1,4 @@ | |||
| FROM --platform=$BUILDPLATFORM docker-0.unsee.tech/golang:alpine AS builder | |||
| FROM docker-0.unsee.tech/golang:alpine AS builder | |||
| WORKDIR /app | |||
| ENV GOPROXY=https://goproxy.cn \ | |||
| GO111MODULE=on \ | |||
| @@ -19,46 +19,34 @@ RUN --mount=type=cache,target=/go/pkg/mod \ | |||
| --mount=type=cache,target=/root/.cache/go-build \ | |||
| mage linux all | |||
| # agent | |||
| FROM --platform=$TARGETPLATFORM docker-0.unsee.tech/alpine:latest AS agentimage | |||
| # 基础运行环境 | |||
| FROM docker-0.unsee.tech/alpine:latest AS base | |||
| WORKDIR /app | |||
| COPY --from=builder /app/storage/build/agent . | |||
| RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | |||
| RUN apk add --no-cache tzdata | |||
| ENV TZ=Asia/Shanghai | |||
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |||
| # agent | |||
| FROM base AS agentimage | |||
| COPY --from=builder /app/storage/build/agent . | |||
| RUN chmod +x agent/agent | |||
| ENTRYPOINT ["./agent/agent"] | |||
| # coordinator | |||
| FROM --platform=$TARGETPLATFORM docker-0.unsee.tech/alpine:latest AS coorimage | |||
| WORKDIR /app | |||
| FROM base AS coorimage | |||
| COPY --from=builder /app/storage/build/coordinator . | |||
| RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | |||
| RUN apk add --no-cache tzdata | |||
| ENV TZ=Asia/Shanghai | |||
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |||
| RUN chmod +x coordinator/coordinator | |||
| ENTRYPOINT ["./coordinator/coordinator"] | |||
| # scanner | |||
| FROM --platform=$TARGETPLATFORM docker-0.unsee.tech/alpine:latest AS scannerimage | |||
| WORKDIR /app | |||
| FROM base AS scannerimage | |||
| COPY --from=builder /app/storage/build/scanner . | |||
| RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | |||
| RUN apk add --no-cache tzdata | |||
| ENV TZ=Asia/Shanghai | |||
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |||
| RUN chmod +x scanner/scanner | |||
| ENTRYPOINT ["./scanner/scanner"] | |||
| # client | |||
| FROM --platform=$TARGETPLATFORM docker-0.unsee.tech/alpine:latest AS clientimage | |||
| WORKDIR /app | |||
| FROM base AS clientimage | |||
| COPY --from=builder /app/storage/build/client . | |||
| RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | |||
| RUN apk add --no-cache tzdata | |||
| ENV TZ=Asia/Shanghai | |||
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |||
| RUN chmod +x client/client | |||
| ENTRYPOINT ["./client/client","serve","http"] | |||