From 5959d056f359b2a9c8a26a56b9e14b2bb911732f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 29 Apr 2023 18:35:11 +0200 Subject: [PATCH] Fix arm build (#302) * WIP. * WIP. * WIP. --- .docker/base/Dockerfile.arm | 38 +++++++++++++++++++--------------- .github/workflows/ghcr-arm.yml | 37 ++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/.docker/base/Dockerfile.arm b/.docker/base/Dockerfile.arm index 7c1272e..1ebef51 100644 --- a/.docker/base/Dockerfile.arm +++ b/.docker/base/Dockerfile.arm @@ -32,24 +32,27 @@ RUN ./build # # STAGE 2: CLIENT # -FROM node:18-bullseye-slim as client - -# install dependencies -RUN set -eux; apt-get update; \ - apt-get install -y --no-install-recommends python2 build-essential - -WORKDIR /src - # -# install dependencies -COPY client/package*.json ./ -RUN npm install - +# Because client builds fail in Github Actions, therefor we build it outside of Docker. +# +# FROM node:18-bullseye-slim as client +# +# # install dependencies +# RUN set -eux; apt-get update; \ +# apt-get install -y --no-install-recommends python2 build-essential +# +# WORKDIR /src +# +# # +# # install dependencies +# COPY client/package*.json ./ +# RUN npm install +# +# # +# # build client +# COPY client/ . +# RUN npm run build # -# build client -COPY client/ . -RUN npm run build - # # STAGE 3: RUNTIME # @@ -134,7 +137,8 @@ ENV NEKO_BIND=:8080 # # copy static files from previous stages COPY --from=server /src/bin/neko /usr/bin/neko -COPY --from=client /src/dist/ /var/www +# COPY --from=client /src/dist/ /var/www +COPY client/dist/ /var/www HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ CMD wget -O - http://localhost:${NEKO_BIND#*:}/health || exit 1 diff --git a/.github/workflows/ghcr-arm.yml b/.github/workflows/ghcr-arm.yml index 17f97cd..0981f2f 100644 --- a/.github/workflows/ghcr-arm.yml +++ b/.github/workflows/ghcr-arm.yml @@ -13,7 +13,7 @@ env: PLATFORMS: linux/arm64,linux/arm/v7 jobs: - build-base: + build-client: runs-on: ubuntu-latest # # do not run on forks @@ -23,6 +23,41 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - + name: Set up node + uses: actions/setup-node@v3 + with: + node-version: 18.x + - + name: Build client + run: | + cd client + npm install + npm run build + - + name: Upload client dist + uses: actions/upload-artifact@v3 + with: + name: client-dist + path: client/dist + + build-base: + runs-on: ubuntu-latest + # + # do not run on forks + # + if: github.repository_owner == 'm1k1o' + needs: [ build-client ] + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Download client dist + uses: actions/download-artifact@v3 + with: + name: client-dist + path: client/dist - name: Set up QEMU uses: docker/setup-qemu-action@v1