mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
🚀 CD build.
This commit is contained in:
parent
e2d12de97d
commit
9f7c1804b2
|
|
@ -1,6 +1,6 @@
|
||||||
steps:
|
steps:
|
||||||
- name: gcr.io/cloud-builders/docker
|
- name: gcr.io/cloud-builders/docker
|
||||||
args: ['build', '-t', 'gcr.io/$PROJECT_ID/dendrite-monolith:$COMMIT_SHA', '-f', 'Dockerfile', '.']
|
args: ['build', '--build-arg', 'BUILDPLATFORM=linux/amd64', '-t', 'gcr.io/$PROJECT_ID/dendrite-monolith:$COMMIT_SHA', '-f', 'Dockerfile', '.']
|
||||||
- name: gcr.io/cloud-builders/kubectl
|
- name: gcr.io/cloud-builders/kubectl
|
||||||
args: ['-n', 'dendrite', 'set', 'image', 'deployment/dendrite', 'dendrite=gcr.io/$PROJECT_ID/dendrite-monolith:$COMMIT_SHA']
|
args: ['-n', 'dendrite', 'set', 'image', 'deployment/dendrite', 'dendrite=gcr.io/$PROJECT_ID/dendrite-monolith:$COMMIT_SHA']
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
19
Dockerfile
19
Dockerfile
|
|
@ -4,8 +4,23 @@
|
||||||
FROM --platform=${BUILDPLATFORM} docker.io/golang:1.20-alpine AS base
|
FROM --platform=${BUILDPLATFORM} docker.io/golang:1.20-alpine AS base
|
||||||
RUN apk --update --no-cache add bash build-base curl
|
RUN apk --update --no-cache add bash build-base curl
|
||||||
|
|
||||||
WORKDIR /build
|
#
|
||||||
COPY . /build
|
# build creates all needed binaries
|
||||||
|
#
|
||||||
|
FROM --platform=${BUILDPLATFORM} base AS build
|
||||||
|
WORKDIR /src
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG FLAGS
|
||||||
|
RUN --mount=target=. \
|
||||||
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
|
USERARCH=`go env GOARCH` \
|
||||||
|
GOARCH="$TARGETARCH" \
|
||||||
|
GOOS="linux" \
|
||||||
|
CGO_ENABLED=$([ "$TARGETARCH" = "$USERARCH" ] && echo "1" || echo "0") \
|
||||||
|
go build -v -ldflags="${FLAGS}" -trimpath -o /out/ ./cmd/...
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Builds the Dendrite image containing all required binaries
|
# Builds the Dendrite image containing all required binaries
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue