mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-30 13:52:56 -08:00
Merge pull request #170 from element-hq/bbz/matrix-tools-multi-arch
Make matrix-tools image multi-arch
This commit is contained in:
6 files changed
+54
-68
No files matched your search
@@ -1,8 +1,8 @@
|
||||
# Copyright 2024 New Vector Ltd
|
||||
# Copyright 2025 New Vector Ltd
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
|
||||
name: Build Docker Images
|
||||
name: Build matrix-tool Docker Images
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
@@ -14,8 +14,7 @@ on:
|
||||
- 'matrix-tools-*'
|
||||
|
||||
env:
|
||||
DOCKER_REGISTRY: ghcr.io/${{ github.repository }}
|
||||
BAKE_TARGET: matrix-tools
|
||||
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/matrix-tools
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -55,54 +54,49 @@ jobs:
|
||||
- tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Inspect Builder
|
||||
run: docker buildx inspect
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get Release Tag
|
||||
if: github.ref_type == 'tag' # Only for GitHub releases
|
||||
run: |
|
||||
echo "Converting $GITHUB_REF to tags"
|
||||
echo "VERSION=${GITHUB_REF#refs\/tags\/matrix-tools-}" >> $GITHUB_ENV
|
||||
- name: Get Release Tag
|
||||
if: github.ref_type == 'tag' # Only for GitHub releases
|
||||
run: |
|
||||
echo "Converting $GITHUB_REF to tags"
|
||||
echo "VERSION=${GITHUB_REF#refs\/tags\/matrix-tools-}" >> $GITHUB_ENV
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@master
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKER_REGISTRY }}/${{ env.BAKE_TARGET }}
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=raw,value=${{ env.VERSION }},enable=${{ github.ref_type == 'tag' }}
|
||||
type=sha,prefix=sha-,format=short
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.REGISTRY_IMAGE }}
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
type=raw,value=${{ env.VERSION }},enable=${{ github.ref_type == 'tag' }}
|
||||
type=sha,prefix=sha-,format=short
|
||||
labels: |
|
||||
org.opencontainers.image.licenses=AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
annotations: |
|
||||
org.opencontainers.image.licenses=AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
|
||||
- name: Build and Push Image
|
||||
id: build_image
|
||||
uses: docker/[email protected]
|
||||
with:
|
||||
# Only for tags
|
||||
push: "${{ github.ref_type == 'tag' }}"
|
||||
files: |
|
||||
docker-bake.hcl
|
||||
${{ steps.meta.outputs.bake-file }}
|
||||
targets: |
|
||||
${{ env.BAKE_TARGET }}
|
||||
# Override the docker bake target with Bakefile options specific to
|
||||
# releasing the docker images.
|
||||
#
|
||||
# All options: https://docs.docker.com/reference/cli/docker/buildx/bake/#set
|
||||
# Option descriptions: https://docs.docker.com/build/bake/reference/
|
||||
#
|
||||
# note: "base" is the target called "base".
|
||||
set: |
|
||||
base.output=type=image
|
||||
- name: Build and Push Image
|
||||
uses: docker/bake-action@v6
|
||||
with:
|
||||
push: "${{ github.ref_type == 'tag' }}"
|
||||
files: |
|
||||
docker-bake.hcl
|
||||
cwd://${{ steps.meta.outputs.bake-file }}
|
||||
targets: matrix-tools
|
||||
set: |
|
||||
*.output=type=image
|
||||
*.platform=linux/amd64,linux/arm64
|
||||
@@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
|
||||
## The matrix-tools iamge, used in multiple components
|
||||
matrixTools:
|
||||
{{ image(registry="ghcr.io", repository="element-hq/ess-helm/matrix-tools", tag="0.2.1") | indent(2) }}
|
||||
{{ image(registry="ghcr.io", repository="element-hq/ess-helm/matrix-tools", tag="0.3.0") | indent(2) }}
|
||||
|
||||
## The server name of the Matrix Stack. This gets embedded in user IDs & room IDs
|
||||
## It can not change after the initial deployment.
|
||||
|
||||
@@ -20,7 +20,7 @@ matrixTools:
|
||||
|
||||
## The tag of the container image to use.
|
||||
## Defaults to the Chart's appVersion if not set
|
||||
tag: "0.2.1"
|
||||
tag: "0.3.0"
|
||||
|
||||
## Container digest to use. Used to pull the image instead of the image tag / Chart appVersion if set
|
||||
# digest:
|
||||
|
||||
+1
-11
@@ -5,18 +5,8 @@
|
||||
// Targets filled by GitHub Actions: one for the regular tag
|
||||
target "docker-metadata-action" {}
|
||||
|
||||
// This sets the platforms and is further extended by GitHub Actions to set the
|
||||
// output and the cache locations
|
||||
target "base" {
|
||||
platforms = [
|
||||
"linux/amd64",
|
||||
// "linux/arm64",
|
||||
]
|
||||
}
|
||||
|
||||
// Top-level target to build the matrix-tools container image
|
||||
target "matrix-tools" {
|
||||
inherits = ["base", "docker-metadata-action"]
|
||||
inherits = ["docker-metadata-action"]
|
||||
dockerfile = "Dockerfile"
|
||||
context = "./matrix-tools"
|
||||
}
|
||||
@@ -2,19 +2,20 @@
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
|
||||
FROM golang:1.23 AS buildstage
|
||||
FROM --platform=${BUILDPLATFORM} golang:1.23 AS buildstage
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
RUN go mod download
|
||||
RUN CGO_ENABLED=0 go build -o /app/matrix-tools cmd/main.go
|
||||
RUN chmod 755 /app/matrix-tools
|
||||
|
||||
ARG TARGETOS TARGETARCH
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o /app/matrix-tools cmd/main.go
|
||||
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
LABEL org.opencontainers.image.licenses="AGPL-3.0-only OR LicenseRef-Element-Commercial"
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=buildstage /app/matrix-tools /
|
||||
COPY --from=buildstage --chmod=0755 /app/matrix-tools /
|
||||
EXPOSE 8443
|
||||
ENTRYPOINT ["/matrix-tools"]
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Support arm64 in matrix-tools image.
|
||||
Reference in new issue
Block a user