From ca7582987656e45732d7fcf54269a58521dc36e7 Mon Sep 17 00:00:00 2001 From: Jay Zhang Date: Fri, 4 Oct 2024 03:55:09 +0000 Subject: [PATCH] feat: build multiplatform images --- .github/workflows/build-docker.yml | 6 +++++- Dockerfile | 14 +++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index beb124f..8add8e4 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -2,7 +2,8 @@ name: Build Docker on: push: - branches: [ "main" ] + branches: + - '**' tags: - '**' paths-ignore: @@ -19,6 +20,8 @@ jobs: - id: pre-step shell: bash run: echo "image-tag=$(git describe --tags --always)" >> $GITHUB_OUTPUT + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build & Publish Docker Image uses: elgohr/Publish-Docker-Github-Action@v5 with: @@ -26,5 +29,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io + platforms: linux/amd64,linux/arm64 tags: "${{ github.ref == 'refs/heads/main' && 'latest,' || '' }}${{ steps.pre-step.outputs.image-tag }}" no_push: ${{ github.event_name == 'pull_request' }} diff --git a/Dockerfile b/Dockerfile index eeaface..332e5bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,20 +29,20 @@ RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommend RUN pip3 install debugpy # install golang -RUN wget --no-check-certificate --progress=dot:mega https://go.dev/dl/go1.22.3.linux-amd64.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xvf go1.22.3.linux-amd64.tar.gz && \ - rm go1.22.3.linux-amd64.tar.gz +RUN export ARCH=$(dpkg --print-architecture) && curl -OL https://go.dev/dl/go1.22.3.linux-${ARCH}.tar.gz && \ + rm -rf /usr/local/go && tar -C /usr/local -xvf go1.22.3.linux-${ARCH}.tar.gz && rm go1.22.3.linux-${ARCH}.tar.gz # install tman -RUN wget --no-check-certificate --progress=dot:mega https://github.com/TEN-framework/ten_framework/releases/download/0.3.0-alpha/tman-linux-x64-clang-release.zip && \ - unzip tman-linux-x64-clang-release.zip && \ +RUN export ARCH=$(dpkg --print-architecture) && \ + if [ ${ARCH} = "amd64" ]; then export ARCH="x64" ; fi && \ + wget --no-check-certificate --progress=dot:mega https://github.com/TEN-framework/ten_framework/releases/download/0.3.0-alpha/tman-linux-${ARCH}-clang-release.zip && \ + unzip tman-linux-${ARCH}-clang-release.zip && \ mv ten_manager/bin/tman /usr/local/bin/ && \ rm -rf tman-*.zip ten_manager # install ten_gn RUN git clone https://github.com/TEN-framework/ten_gn.git /usr/local/ten_gn && \ cd /usr/local/ten_gn && \ - git checkout d6018ddf9b7d7c851bb416a2e77f24fc9719dc4c + git checkout 9bbd871c3a645b63a00e21fcb2bedb69848e703e ENV PATH=/usr/local/go/bin:/usr/local/ten_gn:$PATH