Merge pull request #382 from toeverything/develop

chore: build for keck
This commit is contained in:
DarkSky 2022-09-07 16:38:08 +08:00 committed by GitHub
commit d5878d60c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 1 deletions

View File

@ -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"]

2
.github/env/.env.local-keck vendored Normal file
View File

@ -0,0 +1,2 @@
NX_LOCAL=true
NX_KECK=true

85
.github/workflows/affine-keck.yml vendored Normal file
View File

@ -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 }}

View File

@ -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(

View File

@ -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",