FROM node:alpine AS node-builder ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN npm i -g pnpm WORKDIR /build COPY web/package.json web/pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile COPY web . RUN pnpm run build FROM golang:alpine AS go-builder RUN go env -w CGO_ENABLED=0 WORKDIR /build COPY go.mod go.sum ./ RUN go mod download COPY . . COPY --from=node-builder /build/dist ./web/dist RUN go build -trimpath -ldflags '-extldflags "-static -fpic" -s -w' -tags="web nomsgpack" -o core ./cmd/core FROM alpine:latest RUN apk update && \ apk upgrade --no-cache && \ apk add --no-cache tzdata ca-certificates && \ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo 'Asia/Shanghai' >/etc/timezone && \ rm -rf /var/cache/apk/* WORKDIR /data COPY --from=go-builder /build/core /usr/bin/core RUN chmod +x /usr/bin/core ENTRYPOINT [ "/usr/bin/core" ]