From 0bea03fb15da47bfe0ead3eabafd8a56802d88de Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Tue, 28 May 2024 17:45:50 +0200 Subject: [PATCH] Build and release Moco controller/backup images for arm64 --- .github/workflows/release.yaml | 8 ++++---- Dockerfile | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 60cfbf7d9..7ac2fa7b2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 @@ -37,7 +37,7 @@ jobs: with: builder: ${{ steps.buildx.outputs.name }} push: true - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} target: controller labels: ${{ steps.meta.outputs.labels }} @@ -51,7 +51,7 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 @@ -76,7 +76,7 @@ jobs: with: builder: ${{ steps.buildx.outputs.name }} push: true - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/Dockerfile b/Dockerfile index 226dffd8b..da07f3ea9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,9 @@ FROM --platform=$TARGETPLATFORM ghcr.io/cybozu-go/moco/mysql:8.0.37.1 as mysql FROM --platform=$TARGETPLATFORM ghcr.io/cybozu/ubuntu:22.04 LABEL org.opencontainers.image.source https://github.com/cybozu-go/moco -ARG MYSQLSH_VERSION=8.0.37-1 +ARG MYSQLSH_VERSION=8.0.37 +ARG MYSQLSH_GLIBC_VERSION=2.28 +ARG TARGETARCH COPY --from=builder /work/moco-backup /moco-backup @@ -37,10 +39,13 @@ COPY --from=mysql /usr/local/mysql/bin/mysql /usr/local/mysql/bin/mysql RUN apt-get update \ && apt-get install -y --no-install-recommends libjemalloc2 zstd python3 libpython3.10 s3cmd \ && rm -rf /var/lib/apt/lists/* \ - && curl -o /tmp/mysqlsh.deb -fsL https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell_${MYSQLSH_VERSION}ubuntu22.04_amd64.deb \ - && dpkg -i /tmp/mysqlsh.deb \ - && rm -f /tmp/mysqlsh.deb - -ENV PATH=/usr/local/mysql/bin:"$PATH" + && if [ "${TARGETARCH}" = 'amd64' ]; then MYSQLSH_ARCH='x86-64'; fi \ + && if [ "${TARGETARCH}" = 'arm64' ]; then MYSQLSH_ARCH='arm-64'; fi \ + && curl -o /tmp/mysqlsh.tar.gz -fsL "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${MYSQLSH_VERSION}-linux-glibc${MYSQLSH_GLIBC_VERSION}-${MYSQLSH_ARCH:-unknown}bit.tar.gz" \ + && mkdir /usr/local/mysql-shell \ + && tar -xf /tmp/mysqlsh.tar.gz -C /usr/local/mysql-shell --strip-components=1 \ + && rm -f /tmp/mysqlsh.tar.gz + +ENV PATH=/usr/local/mysql/bin:/usr/local/mysql-shell/bin:"$PATH" USER 10000:10000 ENTRYPOINT ["/moco-backup"]