mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-21 13:23:03 +01:00
ci(docker): distribute build across multiple runners (#286)
Docker build for multiplatform arch is too slow sequentially on the same runner. The build is now distributed on multiple runners. Each architecure image is pushed as a digest and is reconciled into a single image afterwards.
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -1,25 +1,26 @@
|
||||
FROM golang:1.21 AS build
|
||||
|
||||
ENV PORT 10000
|
||||
WORKDIR /src
|
||||
RUN go env -w GOMODCACHE=/root/.cache/go-build
|
||||
|
||||
WORKDIR /go/src/sablier
|
||||
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . /go/src/sablier
|
||||
# See https://docs.docker.com/build/guide/mounts/#add-bind-mounts for cached builds
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download
|
||||
|
||||
COPY . /src
|
||||
ARG BUILDTIME
|
||||
ARG VERSION
|
||||
ARG REVISION
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
RUN make BUILDTIME=${BUILDTIME} VERSION=${VERSION} GIT_REVISION=${REVISION} ${TARGETOS}/${TARGETARCH}
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
make BUILDTIME=${BUILDTIME} VERSION=${VERSION} GIT_REVISION=${REVISION} ${TARGETOS}/${TARGETARCH}
|
||||
|
||||
FROM alpine:3.19.1
|
||||
|
||||
COPY --from=build /go/src/sablier/sablier* /etc/sablier/sablier
|
||||
COPY --from=build /src/sablier* /etc/sablier/sablier
|
||||
COPY docker/sablier.yaml /etc/sablier/sablier.yaml
|
||||
|
||||
EXPOSE 10000
|
||||
|
||||
Reference in New Issue
Block a user