mod sync and archive plugin

This commit is contained in:
royalcat 2025-03-22 23:23:30 +04:00
parent 3f01d7032f
commit 237af4a63e
16 changed files with 432 additions and 51 deletions

View file

@ -4,24 +4,26 @@ FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS builder
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all
COPY go.work ./
COPY go.work.sum ./
COPY ./plugins ./plugins
COPY ./pkg ./pkg
COPY ./src ./src
COPY ./cmd ./cmd
COPY ./server ./server
COPY ./edition ./edition
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all
ARG TARGETOS TARGETARCH
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod \
GOOS=$TARGETOS GOARCH=$TARGETARCH \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -tags timetzdata \
-o /tstor ./cmd/tstor/main.go
-o /tstor-bin ./edition
RUN chmod +x /tstor-bin
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /tstor /tstor
COPY --from=builder /tstor-bin /tstor-bin
ENTRYPOINT ["/tstor"]
CMD ["/tstor-bin"]