fix arm builds

This commit is contained in:
perf3ct 2024-08-08 14:38:39 -07:00
parent 36f51baf2b
commit 676bff43d9
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 160 additions and 142 deletions

View File

@ -16,7 +16,7 @@ env:
DOCKERHUB_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
TEST_TAG: triliumnext/notes:test
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8
jobs:
test_docker:
@ -73,21 +73,29 @@ jobs:
packages: write
attestations: write
id-token: write
strategy:
matrix:
architecture: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm64/v8]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Extract metadata (tags, labels) for GHCR image
id: ghcr-meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v4
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
tags:
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Extract metadata (tags, labels) for DockerHub image
id: dh-meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
@ -99,7 +107,7 @@ jobs:
- name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json
- name: Log in to the GHCR container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
uses: docker/login-action@v2
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
@ -110,7 +118,7 @@ jobs:
id: ghcr-push
with:
context: .
platforms: ${{ env.PLATFORMS }}
platforms: ${{ matrix.architecture }}
push: true
tags: ${{ steps.ghcr-meta.outputs.tags }}
labels: ${{ steps.ghcr-meta.outputs.labels }}
@ -123,7 +131,7 @@ jobs:
subject-digest: ${{ steps.ghcr-push.outputs.digest }}
push-to-registry: true
- name: Log in to the DockerHub container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKERHUB_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
@ -133,7 +141,7 @@ jobs:
id: dh-push
with:
context: .
platforms: ${{ env.PLATFORMS }}
platforms: ${{ matrix.architecture }}
push: true
tags: ${{ steps.dh-meta.outputs.tags }}
labels: ${{ steps.dh-meta.outputs.labels }}
@ -145,4 +153,3 @@ jobs:
subject-name: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.dh-push.outputs.digest }}
push-to-registry: true

View File

@ -1,8 +1,8 @@
# !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!!
FROM node:20.15.1-alpine
FROM node:20.15.1-bullseye-slim
# Configure system dependencies
RUN apk add --no-cache --virtual .build-dependencies \
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
g++ \
@ -11,7 +11,9 @@ RUN apk add --no-cache --virtual .build-dependencies \
make \
nasm \
libpng-dev \
python3
python3 \
gosu \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /usr/src/app
@ -32,24 +34,33 @@ RUN rm docker_healthcheck.ts
RUN rm -r build
# Install app dependencies
RUN set -x \
&& npm install \
&& apk del .build-dependencies \
&& npm run webpack \
&& npm prune --omit=dev \
&& cp src/public/app/share.js src/public/app-dist/. \
&& cp -r src/public/app/doc_notes src/public/app-dist/. \
&& rm -rf src/public/app \
&& rm src/services/asset_path.ts
RUN set -x
RUN npm install
RUN apt-get purge -y --auto-remove \
autoconf \
automake \
g++ \
gcc \
libtool \
make \
nasm \
libpng-dev \
python3 \
&& rm -rf /var/lib/apt/lists/*
RUN npm run webpack
RUN npm prune --omit=dev
RUN cp src/public/app/share.js src/public/app-dist/.
RUN cp -r src/public/app/doc_notes src/public/app-dist/.
RUN rm -rf src/public/app
RUN rm src/services/asset_path.ts
# Some setup tools need to be kept
RUN apk add --no-cache su-exec shadow
# Add application user and setup proper volume permissions
RUN adduser -s /bin/false node; exit 0
RUN apt-get update && apt-get install -y --no-install-recommends \
gosu \
&& rm -rf /var/lib/apt/lists/*
# Start the application
EXPOSE 8080
CMD [ "./start-docker.sh" ]
HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
HEALTHCHECK --start-period=10s CMD exec gosu node node docker_healthcheck.js