mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
build: fix native module in aarch64 docker image (#4656)
This commit is contained in:
36
.github/workflows/deploy.yml
vendored
36
.github/workflows/deploy.yml
vendored
@@ -87,6 +87,28 @@ jobs:
|
|||||||
path: ./packages/backend/storage/storage.node
|
path: ./packages/backend/storage/storage.node
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-storage-arm64:
|
||||||
|
name: Build Storage arm64
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: ${{ github.event.inputs.flavor }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: ./.github/actions/build-rust
|
||||||
|
with:
|
||||||
|
target: 'aarch64-unknown-linux-gnu'
|
||||||
|
package: '@affine/storage'
|
||||||
|
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
||||||
|
- name: Upload storage.node
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storage.arm64.node
|
||||||
|
path: ./packages/backend/storage/storage.node
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
name: Build Docker
|
name: Build Docker
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -95,6 +117,7 @@ jobs:
|
|||||||
- build-server
|
- build-server
|
||||||
- build-core
|
- build-core
|
||||||
- build-storage
|
- build-storage
|
||||||
|
- build-storage-arm64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Download core artifact
|
- name: Download core artifact
|
||||||
@@ -112,6 +135,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: storage.node
|
name: storage.node
|
||||||
path: ./packages/backend/server
|
path: ./packages/backend/server
|
||||||
|
- name: Download storage.node arm64
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storage.arm64.node
|
||||||
|
path: ./packages/backend/storage
|
||||||
|
- name: move storage.arm64.node
|
||||||
|
run: mv ./packages/backend/storage/storage.node ./packages/backend/server/storage.arm64.node
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
run: |
|
run: |
|
||||||
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
||||||
@@ -154,7 +184,9 @@ jobs:
|
|||||||
scope: '@toeverything'
|
scope: '@toeverything'
|
||||||
|
|
||||||
- name: Install Node.js dependencies
|
- name: Install Node.js dependencies
|
||||||
run: yarn workspaces focus @affine/server --production
|
run: |
|
||||||
|
yarn config set --json supportedArchitectures.cpu '["x64", "arm64"]'
|
||||||
|
yarn workspaces focus @affine/server --production
|
||||||
|
|
||||||
- name: Generate Prisma client
|
- name: Generate Prisma client
|
||||||
run: yarn workspace @affine/server prisma generate
|
run: yarn workspace @affine/server prisma generate
|
||||||
@@ -168,7 +200,7 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
provenance: true
|
provenance: true
|
||||||
file: .github/deployment/node/Dockerfile
|
file: .github/deployment/node/Dockerfile
|
||||||
tags: ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-front:${{env.RELEASE_FLAVOR}}
|
tags: ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}-${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-graphql:${{env.RELEASE_FLAVOR}}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy to cluster
|
name: Deploy to cluster
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
binaryTargets = ["native", "debian-openssl-3.0.x"]
|
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
|
||||||
previewFeatures = ["metrics", "tracing"]
|
previewFeatures = ["metrics", "tracing"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ try {
|
|||||||
storageModule = await import('@affine/storage');
|
storageModule = await import('@affine/storage');
|
||||||
} catch {
|
} catch {
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
storageModule = require('../../storage.node');
|
storageModule =
|
||||||
|
process.arch === 'arm64'
|
||||||
|
? require('../../storage.arm64.node')
|
||||||
|
: require('../../storage.node');
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StorageModule {
|
export class StorageModule {
|
||||||
|
|||||||
Reference in New Issue
Block a user