From 1f3832fa14681eec65a8925b3dd6437b4c127faf Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 01:39:21 +0900 Subject: [PATCH 01/11] replace google-chrome with chromium google-chrome is not available for ARM --- Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c976e1a..26a5972 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,17 @@ FROM node:19 WORKDIR /app # We don't need the standalone Chromium -RUN apt-get install -y wget \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ - && apt-get update && apt-get -y install google-chrome-stable chromium xvfb\ - && rm -rf /var/lib/apt/lists/* \ - && echo "Chrome: " && google-chrome --version +COPY debian-stable.list /etc/apt/sources.list.d/debian-stable.list +RUN apt-get install -y wget curl gnupg \ + && apt-get update && apt-get -y install chromium xvfb \ + && echo "Chrome: " && chromium --version \ + && ln -s /usr/bin/chromium /usr/bin/google-chrome-stable + && rm -rf /var/lib/apt/lists/* + COPY package.json . COPY package-lock.json . RUN npm install COPY . . RUN npm run build EXPOSE 4000 -CMD npx prisma migrate deploy && xvfb-run --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR -maxclients 2048" node dist/index.js \ No newline at end of file +CMD npx prisma migrate deploy && xvfb-run --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR -maxclients 2048" node dist/index.js From 62579cb17f7e00217a8be525b129fb540cb39ebb Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 01:43:38 +0900 Subject: [PATCH 02/11] source for Chromium --- debian-stable.list | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 debian-stable.list diff --git a/debian-stable.list b/debian-stable.list new file mode 100644 index 0000000..ffb5482 --- /dev/null +++ b/debian-stable.list @@ -0,0 +1,8 @@ +deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable main +deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable main + +deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian-security/ stable-security main +deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian-security/ stable-security main + +deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable-updates main +deb-src [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian stable-updates main From 9d47b9112361046d2eb17e433076e996d2fe786c Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 19:41:10 +0900 Subject: [PATCH 03/11] Seperating ARM64 and others To produce different Docker images for different platforms --- Dockerfile | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 26a5972..00b3d83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,27 @@ FROM node:19 WORKDIR /app +ARG TARGETPLATFORM + +RUN echo "Building for $TARGETPLATFORM" + # We don't need the standalone Chromium -COPY debian-stable.list /etc/apt/sources.list.d/debian-stable.list -RUN apt-get install -y wget curl gnupg \ - && apt-get update && apt-get -y install chromium xvfb \ - && echo "Chrome: " && chromium --version \ - && ln -s /usr/bin/chromium /usr/bin/google-chrome-stable - && rm -rf /var/lib/apt/lists/* +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ + COPY debian-stable.list /etc/apt/sources.list.d/debian-stable.list; \ + RUN apt-get install -y wget curl gnupg \ + && apt-get update && apt-get -y install chromium xvfb \ + && echo "Chrome: " && chromium --version \ + && ln -s /usr/bin/chromium /usr/bin/google-chrome-stable + && rm -rf /var/lib/apt/lists/* ; + else \ + RUN apt-get install -y wget \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ + && apt-get update && apt-get -y install google-chrome-stable chromium xvfb\ + && rm -rf /var/lib/apt/lists/* \ + && echo "Chrome: " && google-chrome --version ; \ + fi + COPY package.json . COPY package-lock.json . RUN npm install From 55ee7d1bcd87d9f48175f2f3e5db76063acae8f6 Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 21:01:36 +0900 Subject: [PATCH 04/11] Update ci.yml --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bc9be8..9459928 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Node.js CI on: push: - branches: [main] + branches: [chromium-patch-1, main] pull_request: branches: [main] env: @@ -10,7 +10,7 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: + build: runs-on: ubuntu-latest permissions: contents: read @@ -20,6 +20,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Display current branch + run: echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" + - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: @@ -37,6 +40,6 @@ jobs: uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: context: . - push: true + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From bd07a4471349bb53e9f70ab16c2396cf4eb3d1d5 Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 21:03:16 +0900 Subject: [PATCH 05/11] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9459928..f08fbfc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Display current branch - run: echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" + # - name: Display current branch + # run: echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 From b162fbbea020ff4831eb585163826567e85c0adc Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 21:41:58 +0900 Subject: [PATCH 06/11] Update Dockerfile --- Dockerfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00b3d83..1ca766b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,24 +4,27 @@ ARG TARGETPLATFORM RUN echo "Building for $TARGETPLATFORM" +COPY debian-stable.list /tmp + # We don't need the standalone Chromium RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ - COPY debian-stable.list /etc/apt/sources.list.d/debian-stable.list; \ - RUN apt-get install -y wget curl gnupg \ + apt-get install -y wget curl gnupg \ + && cp /tmp/debian-stable.list /etc/apt/sources.list.d/ \ && apt-get update && apt-get -y install chromium xvfb \ && echo "Chrome: " && chromium --version \ - && ln -s /usr/bin/chromium /usr/bin/google-chrome-stable - && rm -rf /var/lib/apt/lists/* ; + && ln -s /usr/bin/chromium /usr/bin/google-chrome-stable \ else \ - RUN apt-get install -y wget \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ - && apt-get update && apt-get -y install google-chrome-stable chromium xvfb\ - && rm -rf /var/lib/apt/lists/* \ - && echo "Chrome: " && google-chrome --version ; \ + apt-get install -y wget \ + && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \ + && apt-get update && apt-get -y install google-chrome-stable chromium xvfb\ + && echo "Chrome: " && google-chrome --version ; \ fi - +# Remove tmp file +RUN rm -rf /var/lib/apt/lists/* +RUN rm -rf /tmp/debian-stable.list + COPY package.json . COPY package-lock.json . RUN npm install From 66cce1bad10a4d4f3f168a1fb8467c8690c2205a Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 21:54:53 +0900 Subject: [PATCH 07/11] Update ci.yml added ubuntu-latest-arm64 --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f08fbfc..e3fb99c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,10 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, ubuntu-latest-arm64] permissions: contents: read packages: write From a3b91f41fa83bf0f9304311fb883e21389fa1187 Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 22:17:10 +0900 Subject: [PATCH 08/11] Update ci.yml --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3fb99c..73399b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,13 @@ env: jobs: build: + runs-on: ${{ matrix.os }} +# name: Build on ${{ matrix.distro }} ${{ matrix.arch }} + strategy: matrix: - os: [ubuntu-latest, ubuntu-latest-arm64] + os: [ubuntu-latest-aarch64, ubuntu-latest] permissions: contents: read packages: write From 90005e630ba10d35bcd1f19ad5019da7541d15ea Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 22:35:50 +0900 Subject: [PATCH 09/11] Update ci.yml --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73399b7..224939f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,66 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + + build_arms: + + runs-on: ubuntu-20.04 + name: Build on ${{ matrix.distro }} ${{ matrix.arch }} + + strategy: + matrix: + include: + - arch: aarch64 + distro: ubuntu20.04 + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - uses: uraimo/run-on-arch-action@v2 + name: Build artifact + id: build + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + githubToken: ${{ github.token }} + run: | + uname -a + echo ::set-output name=uname::$(uname -a) + + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build: runs-on: ${{ matrix.os }} -# name: Build on ${{ matrix.distro }} ${{ matrix.arch }} strategy: matrix: - os: [ubuntu-latest-aarch64, ubuntu-latest] + os: [ubuntu-latest] permissions: contents: read packages: write From 7a3bef3cb4637567957d1ee6e17ea657c6e5ca04 Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 22:46:17 +0900 Subject: [PATCH 10/11] set-output warning --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 224939f..7c43121 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,11 +37,10 @@ jobs: arch: ${{ matrix.arch }} distro: ${{ matrix.distro }} githubToken: ${{ github.token }} - run: | - uname -a - echo ::set-output name=uname::$(uname -a) - - + # run: | + # uname -a + # echo ::set-output name=uname::$(uname -a) + - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: From 18a8d992c843cbb6860f1d2908be1ee9f5aa7e02 Mon Sep 17 00:00:00 2001 From: myfingerhurt Date: Wed, 15 Feb 2023 22:49:08 +0900 Subject: [PATCH 11/11] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c43121..356f38a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: arch: ${{ matrix.arch }} distro: ${{ matrix.distro }} githubToken: ${{ github.token }} - # run: | - # uname -a + run: | + uname -a # echo ::set-output name=uname::$(uname -a) - name: Log in to the Container registry