From 97183fff975a9b67d4798d7b6e095c74b8b5a2f4 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 19:04:34 +0300 Subject: [PATCH 01/10] :anchor: Build docker image for aarch64 --- .github/workflows/release.yaml | 40 ++++++------ Dockerfile | 110 ++++++++++++++++++--------------- 2 files changed, 79 insertions(+), 71 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a385d01..7005f25 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,23 +11,23 @@ jobs: containerise: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Get tag - id: tag - uses: dawidd6/action-get-tag@v1 - - uses: docker/build-push-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Log into GitHub Container Registry - run: echo "${{ secrets.REGISTRY_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64 - push: true - tags: ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - cache-from: type=registry,ref=ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - cache-to: type=inline - build-args: | - IMAGE_NAME=${{ env.IMAGE_NAME }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Get tag + id: tag + uses: dawidd6/action-get-tag@v1 + - uses: docker/build-push-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Log into GitHub Container Registry + run: echo "${{ secrets.REGISTRY_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + - name: Build and push + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + # cache-from: type=registry,ref=ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + # cache-to: type=inline + build-args: | + IMAGE_NAME=${{ env.IMAGE_NAME }} diff --git a/Dockerfile b/Dockerfile index 4d0b380..0ce255b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,42 @@ FROM debian:bullseye-slim -ARG ARCH="amd64" +ARG TARGETPLATFORM +ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "amd64" ;; \ + "linux/arm64") echo "aarch64" ;; \ + *) echo "" ;; esac) ARG S6_VERSION="2.2.0.3" +RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "amd64" ;; \ + "linux/arm64") echo "aarch64" ;; \ + *) echo "" ;; esac) \ + && echo "ARCH=${ARCH}, ARCH2=$ARCH" ENV DEBIAN_FRONTEND="noninteractive" \ - HOME="/root" \ - LANGUAGE="en_US.UTF-8" \ - LANG="en_US.UTF-8" \ - LC_ALL="en_US.UTF-8" \ - TERM="xterm" \ - S6_EXPECTED_SHA256="a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" \ - S6_DOWNLOAD="https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-${ARCH}.tar.gz" - + HOME="/root" \ + LANGUAGE="en_US.UTF-8" \ + LANG="en_US.UTF-8" \ + LC_ALL="en_US.UTF-8" \ + TERM="xterm" \ + S6_EXPECTED_SHA256="a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" \ + S6_DOWNLOAD="https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-${ARCH}.tar.gz" # Install third party software RUN set -x && \ - apt-get update && \ - apt-get -y --no-install-recommends install locales && \ - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ - locale-gen en_US.UTF-8 && \ - # Install required distro packages - apt-get -y --no-install-recommends install curl ca-certificates binutils && \ - # Install s6 - curl -L ${S6_DOWNLOAD} --output /tmp/s6-overlay-${ARCH}.tar.gz && \ - sha256sum /tmp/s6-overlay-${ARCH}.tar.gz && \ - echo "${S6_EXPECTED_SHA256} /tmp/s6-overlay-${ARCH}.tar.gz" | sha256sum -c - && \ - tar xzf /tmp/s6-overlay-${ARCH}.tar.gz -C / && \ - # Clean up - rm -rf /tmp/s6-overlay-${ARCH}.tar.gz && \ - apt-get -y autoremove --purge curl binutils + apt-get update && \ + apt-get -y --no-install-recommends install locales && \ + echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ + locale-gen en_US.UTF-8 && \ + # Install required distro packages + apt-get -y --no-install-recommends install curl ca-certificates binutils && \ + # Install s6 + curl -L ${S6_DOWNLOAD} --output /tmp/s6-overlay-${ARCH}.tar.gz && \ + sha256sum /tmp/s6-overlay-${ARCH}.tar.gz && \ + echo "${S6_EXPECTED_SHA256} /tmp/s6-overlay-${ARCH}.tar.gz" | sha256sum -c - && \ + tar xzf /tmp/s6-overlay-${ARCH}.tar.gz -C / && \ + # Clean up + rm -rf /tmp/s6-overlay-${ARCH}.tar.gz && \ + apt-get -y autoremove --purge curl binutils # Copy app COPY tubesync /app @@ -47,24 +55,24 @@ RUN set -x && \ # Install required distro packages apt-get -y install nginx-light && \ apt-get -y --no-install-recommends install \ - python3 \ - python3-setuptools \ - python3-pip \ - python3-dev \ - gcc \ - make \ - default-libmysqlclient-dev \ - libmariadb3 \ - postgresql-common \ - libpq-dev \ - libpq5 \ - libjpeg62-turbo \ - libwebp6 \ - libjpeg-dev \ - zlib1g-dev \ - libwebp-dev \ - ffmpeg \ - redis-server && \ + python3 \ + python3-setuptools \ + python3-pip \ + python3-dev \ + gcc \ + make \ + default-libmysqlclient-dev \ + libmariadb3 \ + postgresql-common \ + libpq-dev \ + libpq5 \ + libjpeg62-turbo \ + libwebp6 \ + libjpeg-dev \ + zlib1g-dev \ + libwebp-dev \ + ffmpeg \ + redis-server && \ # Install pipenv pip3 --disable-pip-version-check install wheel pipenv && \ # Create a 'app' user which the application will run as @@ -88,16 +96,16 @@ RUN set -x && \ pipenv --clear && \ pip3 --disable-pip-version-check uninstall -y pipenv wheel virtualenv && \ apt-get -y autoremove --purge \ - python3-pip \ - python3-dev \ - gcc \ - make \ - default-libmysqlclient-dev \ - postgresql-common \ - libpq-dev \ - libjpeg-dev \ - zlib1g-dev \ - libwebp-dev && \ + python3-pip \ + python3-dev \ + gcc \ + make \ + default-libmysqlclient-dev \ + postgresql-common \ + libpq-dev \ + libjpeg-dev \ + zlib1g-dev \ + libwebp-dev && \ apt-get -y autoremove && \ apt-get -y autoclean && \ rm -rf /var/lib/apt/lists/* && \ From 3943115b18bf2e4e41dc1f77c5336e9522906cc4 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 19:33:03 +0300 Subject: [PATCH 02/10] :checkered_flag: Fix docker build --- Dockerfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ce255b..8c011dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,11 @@ FROM debian:bullseye-slim ARG TARGETPLATFORM -ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ - "linux/amd64") echo "amd64" ;; \ - "linux/arm64") echo "aarch64" ;; \ - *) echo "" ;; esac) +# ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ +# "linux/amd64") echo "amd64" ;; \ +# "linux/arm64") echo "aarch64" ;; \ +# *) echo "" ;; esac) ARG S6_VERSION="2.2.0.3" -RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ - "linux/amd64") echo "amd64" ;; \ - "linux/arm64") echo "aarch64" ;; \ - *) echo "" ;; esac) \ - && echo "ARCH=${ARCH}, ARCH2=$ARCH" ENV DEBIAN_FRONTEND="noninteractive" \ HOME="/root" \ @@ -18,11 +13,19 @@ ENV DEBIAN_FRONTEND="noninteractive" \ LANG="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ TERM="xterm" \ - S6_EXPECTED_SHA256="a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" \ S6_DOWNLOAD="https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-${ARCH}.tar.gz" # Install third party software -RUN set -x && \ +RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "amd64" ;; \ + "linux/arm64") echo "aarch64" ;; \ + *) echo "" ;; esac) && \ + export S6_EXPECTED_SHA256=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" ;; \ + "linux/arm64") echo "84f585a100b610124bb80e441ef2dc2d68ac2c345fd393d75a6293e0951ccfc5" ;; \ + *) echo "" ;; esac) && \ + echo "Building for arch: ${ARCH}, expecting S6 SHA256: ${S6_EXPECTED_SHA256}" && \ + set -x && \ apt-get update && \ apt-get -y --no-install-recommends install locales && \ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ From cb39ece21be08e20b2af18aebff85eb14ad68916 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 19:41:11 +0300 Subject: [PATCH 03/10] :bug: aarch64 test number 3 --- Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c011dd..678ab26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM debian:bullseye-slim ARG TARGETPLATFORM -# ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ -# "linux/amd64") echo "amd64" ;; \ -# "linux/arm64") echo "aarch64" ;; \ -# *) echo "" ;; esac) +ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "amd64" ;; \ + "linux/arm64") echo "aarch64" ;; \ + *) echo "" ;; esac) +ARG ARCH44=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "amd64" ;; \ + "linux/arm64") echo "aarch64" ;; \ + *) echo "" ;; esac) ARG S6_VERSION="2.2.0.3" ENV DEBIAN_FRONTEND="noninteractive" \ @@ -24,7 +28,7 @@ RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ "linux/amd64") echo "a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" ;; \ "linux/arm64") echo "84f585a100b610124bb80e441ef2dc2d68ac2c345fd393d75a6293e0951ccfc5" ;; \ *) echo "" ;; esac) && \ - echo "Building for arch: ${ARCH}, expecting S6 SHA256: ${S6_EXPECTED_SHA256}" && \ + echo "Building for arch: ${ARCH}|${ARCH44}, downloading S6 from: ${S6_DOWNLOAD}}, expecting S6 SHA256: ${S6_EXPECTED_SHA256}" && \ set -x && \ apt-get update && \ apt-get -y --no-install-recommends install locales && \ From 3f699c82ecc71a968c9f83e9ac49ef2f0442b670 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 19:49:29 +0300 Subject: [PATCH 04/10] :performing_arts: Fix dockerfile error --- Dockerfile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 678ab26..3aad7f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,6 @@ FROM debian:bullseye-slim ARG TARGETPLATFORM -ARG ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ - "linux/amd64") echo "amd64" ;; \ - "linux/arm64") echo "aarch64" ;; \ - *) echo "" ;; esac) -ARG ARCH44=$(case ${TARGETPLATFORM:-linux/amd64} in \ - "linux/amd64") echo "amd64" ;; \ - "linux/arm64") echo "aarch64" ;; \ - *) echo "" ;; esac) ARG S6_VERSION="2.2.0.3" ENV DEBIAN_FRONTEND="noninteractive" \ @@ -16,8 +8,7 @@ ENV DEBIAN_FRONTEND="noninteractive" \ LANGUAGE="en_US.UTF-8" \ LANG="en_US.UTF-8" \ LC_ALL="en_US.UTF-8" \ - TERM="xterm" \ - S6_DOWNLOAD="https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-${ARCH}.tar.gz" + TERM="xterm" # Install third party software RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ @@ -28,6 +19,10 @@ RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ "linux/amd64") echo "a7076cf205b331e9f8479bbb09d9df77dbb5cd8f7d12e9b74920902e0c16dd98" ;; \ "linux/arm64") echo "84f585a100b610124bb80e441ef2dc2d68ac2c345fd393d75a6293e0951ccfc5" ;; \ *) echo "" ;; esac) && \ + export S6_DOWNLOAD=$(case ${TARGETPLATFORM:-linux/amd64} in \ + "linux/amd64") echo "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-amd64.tar.gz" ;; \ + "linux/arm64") echo "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-aarch64.tar.gz" ;; \ + *) echo "" ;; esac) && \ echo "Building for arch: ${ARCH}|${ARCH44}, downloading S6 from: ${S6_DOWNLOAD}}, expecting S6 SHA256: ${S6_EXPECTED_SHA256}" && \ set -x && \ apt-get update && \ From 5954dba48dd3e2f0ede297311ec53c7086010764 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 20:28:46 +0300 Subject: [PATCH 05/10] :whale: Add piwheels pip source for arm64 --- Pipfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Pipfile b/Pipfile index fe274fa..f6a3147 100644 --- a/Pipfile +++ b/Pipfile @@ -3,6 +3,11 @@ name = "pypi" url = "https://pypi.org/simple" verify_ssl = true +[[source]] +name = "piwheels" +url = "https://www.piwheels.org/simple" +verify_ssl = true + [dev-packages] [packages] From 4735e72f12e59e543d096fce079e7f080b9e0c6e Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 20:51:48 +0300 Subject: [PATCH 06/10] :recycle: Retry with changes from BigCheeZ/tubesync https://github.com/BigCheeZ/tubesync/tree/aarch64_support --- Dockerfile | 5 +++++ Pipfile | 5 ----- pip.conf | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 pip.conf diff --git a/Dockerfile b/Dockerfile index 3aad7f7..8c119fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,9 @@ RUN export ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \ COPY tubesync /app COPY tubesync/tubesync/local_settings.py.container /app/tubesync/local_settings.py +# Copy over pip.conf to use piwheels +COPY pip.conf /etc/pip.conf + # Add Pipfile COPY Pipfile /app/Pipfile COPY Pipfile.lock /app/Pipfile.lock @@ -62,6 +65,7 @@ RUN set -x && \ python3-pip \ python3-dev \ gcc \ + g++ \ make \ default-libmysqlclient-dev \ libmariadb3 \ @@ -101,6 +105,7 @@ RUN set -x && \ python3-pip \ python3-dev \ gcc \ + g++ \ make \ default-libmysqlclient-dev \ postgresql-common \ diff --git a/Pipfile b/Pipfile index f6a3147..fe274fa 100644 --- a/Pipfile +++ b/Pipfile @@ -3,11 +3,6 @@ name = "pypi" url = "https://pypi.org/simple" verify_ssl = true -[[source]] -name = "piwheels" -url = "https://www.piwheels.org/simple" -verify_ssl = true - [dev-packages] [packages] diff --git a/pip.conf b/pip.conf new file mode 100644 index 0000000..e92bae1 --- /dev/null +++ b/pip.conf @@ -0,0 +1,2 @@ +[global] +extra-index-url=https://www.piwheels.org/simple From 120a19d2bac4852a26bd4f99d2b4e1945776ac58 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 21:45:29 +0300 Subject: [PATCH 07/10] :tractor: Fix ghcr url in release action --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7005f25..b3eb0eb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,8 +26,8 @@ jobs: with: platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - # cache-from: type=registry,ref=ghcr.io/meeb/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - # cache-to: type=inline + tags: ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + cache-from: type=registry,ref=ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + cache-to: type=inline build-args: | IMAGE_NAME=${{ env.IMAGE_NAME }} From a0ca2b30616e7e44ecba1ff94467f104541fec77 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Tue, 7 Jun 2022 21:59:47 +0300 Subject: [PATCH 08/10] :circus_tent: Fix gchr username error --- .github/workflows/release.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b3eb0eb..afbadea 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,13 +21,18 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Log into GitHub Container Registry run: echo "${{ secrets.REGISTRY_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + - name: Lowercase github username for ghcr + id: string + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.actor }} - name: Build and push uses: docker/build-push-action@v2 with: platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - cache-from: type=registry,ref=ghcr.io/${{ github.actor }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + tags: ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + cache-from: type=registry,ref=ghcr.io/${{ github.actor }}${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} cache-to: type=inline build-args: | IMAGE_NAME=${{ env.IMAGE_NAME }} From a3559526cb28b2a5a3b7d077caa2a2a07f779f8e Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Wed, 8 Jun 2022 08:13:36 +0300 Subject: [PATCH 09/10] :cactus: Fix docker cache url --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index afbadea..9e2992d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,7 +32,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} - cache-from: type=registry,ref=ghcr.io/${{ github.actor }}${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + cache-from: type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} cache-to: type=inline build-args: | IMAGE_NAME=${{ env.IMAGE_NAME }} From f1c6fc3086ad98f7ed4cb087d54b3af59d7035b6 Mon Sep 17 00:00:00 2001 From: SweetMNM <44876816+SweetMNM@users.noreply.github.com> Date: Wed, 8 Jun 2022 08:20:08 +0300 Subject: [PATCH 10/10] :circus_tent: Update CI action to support arm64 --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 35127ec..536c080 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,19 +35,24 @@ jobs: containerise: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Log into GitHub Container Registry - run: echo "${{ secrets.REGISTRY_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64 - push: true - tags: ghcr.io/meeb/${{ env.IMAGE_NAME }}:latest - cache-from: type=registry,ref=ghcr.io/meeb/${{ env.IMAGE_NAME }}:latest - cache-to: type=inline - build-args: | - IMAGE_NAME=${{ env.IMAGE_NAME }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Log into GitHub Container Registry + run: echo "${{ secrets.REGISTRY_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + - name: Lowercase github username for ghcr + id: string + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.actor }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:latest + cache-from: type=registry,ref=ghcr.io/${{ steps.string.outputs.lowercase }}/${{ env.IMAGE_NAME }}:latest + cache-to: type=inline + build-args: | + IMAGE_NAME=${{ env.IMAGE_NAME }}