Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore: build for keck

DarkSky2a17f9235c2a
diff --git a/.github/deployment/Dockerfile-affine-keck b/.github/deployment/Dockerfile-affine-keck
new file mode 100644
index 0000000000..ae76e1b01e
--- /dev/null
+++ b/.github/deployment/Dockerfile-affine-keck
@@ -0,0 +1,22 @@
+FROM node:16-alpine as builder
+WORKDIR /app
+COPY . .
+# RUN apk add g++ make python3 git libpng-dev
+RUN apk add git
+RUN npm i -g pnpm@7 && pnpm i --frozen-lockfile --store=node_modules/.pnpm-store --filter "!ligo-virgo-e2e" --filter "!keck" --filter "!venus" && pnpm run build:local-keck --skip-nx-cache
+
+FROM node:16-alpine as relocate
+WORKDIR /app
+COPY --from=builder /app/dist/apps/ligo-virgo ./dist
+COPY --from=builder /app/.github/deployment/Caddyfile-affine ./Caddyfile
+RUN rm ./dist/*.txt
+
+# =============
+# AFFiNE image
+# =============
+FROM caddy:2.4.6-alpine as AFFiNE
+WORKDIR /app
+COPY --from=relocate /app .
+
+EXPOSE 3000
+CMD ["caddy", "run"]
diff --git a/.github/env/.env.local-keck b/.github/env/.env.local-keck
new file mode 100644
index 0000000000..7ea68ace7f
--- /dev/null
+++ b/.github/env/.env.local-keck
@@ -0,0 +1,2 @@
+NX_LOCAL=true
+NX_KECK=true
\ No newline at end of file
diff --git a/.github/workflows/affine-keck.yml b/.github/workflows/affine-keck.yml
new file mode 100644
index 0000000000..7caf6cadbe
--- /dev/null
+++ b/.github/workflows/affine-keck.yml
@@ -0,0 +1,85 @@
+name: Build AFFiNE-Local-Keck
+
+on:
+ push:
+ branches: [master]
+ # pull_request:
+ # branches: [master]
+
+# Cancels all previous workflow runs for pull requests that have not completed.
+# See https://docs.github.com/en/actions/using-jobs/using-concurrency
+concurrency:
+ # The concurrency group contains the workflow name and the branch name for
+ # pull requests or the commit hash for any other events.
+ group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
+ cancel-in-progress: true
+
+env:
+ REGISTRY: ghcr.io
+ NAMESPACE: toeverything
+ AFFINE_IMAGE_NAME: AFFiNE
+ IMAGE_TAG_LATEST: nightly-keck
+ LOCAL_CACHE: localhost:5000/toeverything/relocate:latest
+
+jobs:
+ ligo-virgo:
+ runs-on: self-hosted
+ environment: development
+ permissions:
+ contents: read
+ packages: write
+
+ services:
+ registry:
+ image: registry:2
+ ports:
+ - 5000:5000
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Log in to the Container registry
+ uses: docker/login-action@v2
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ driver-opts: network=host
+
+ - name: Extract metadata (tags, labels) for Docker (AFFiNE-Local)
+ id: meta_affine
+ uses: docker/metadata-action@v4
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.AFFINE_IMAGE_NAME }}
+ tags: ${{ env.IMAGE_TAG_LATEST }}
+
+ - name: Build and push Docker image (AFFINE-Local)
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ push: true
+ file: ./.github/deployment/Dockerfile-affine
+ tags: ${{ env.LOCAL_CACHE }}
+ target: AFFiNE
+
+ - name: Build and push Docker image (AFFINE-Local)
+ uses: docker/build-push-action@v3
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64/v8
+ file: ./.github/deployment/Dockerfile-affine-multiplatform
+ push: ${{ github.ref == 'refs/heads/master' && true || false }}
+ tags: ${{ steps.meta_affine.outputs.tags }}
+ labels: ${{ steps.meta_affine.outputs.labels }}
+ target: AFFiNE
+ build-args: |
+ BASE_IMAGE=${{ env.LOCAL_CACHE }}
diff --git a/libs/datasource/db-service/src/services/database/index.ts b/libs/datasource/db-service/src/services/database/index.ts
index dbbe23bb9e..9586732807 100644
--- a/libs/datasource/db-service/src/services/database/index.ts
+++ b/libs/datasource/db-service/src/services/database/index.ts
@@ -39,7 +39,7 @@ async function _getCurrentToken() {
const _enabled = {
demo: [],
- AFFiNE: ['idb'],
+ AFFiNE: process.env['NX_KECK'] ? ['idb'] : ['idb', 'ws'],
} as any;
async function _getBlockDatabase(
diff --git a/package.json b/package.json
index 88f5c1264e..c845578508 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"start:venus": "nx serve venus",
"build": "nx build ligo-virgo",
"build:local": "env-cmd -f .github/env/.env.local-dev nx build ligo-virgo",
+ "build:local-keck": "env-cmd -f .github/env/.env.local-keck nx build ligo-virgo",
"build:keck": "nx build keck",
"build:venus": "nx build venus",
"build:analytic": "cross-env BUNDLE_ANALYZER=true nx build --skip-nx-cache",