diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 60cfbf7d..7ac2fa7b 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 226dffd8..da07f3ea 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"]