Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 41 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
**/Dockerfile
**/.dockerignore
**/npm-debug.log
**/README.md
**/.next/
**/.git/
**/.env
**/.env.*
**/config.yaml
**/.vscode/
**/.yalc/
**/yalc.lock
**/.gitignore

.git
**/.git

node_modules
**/node_modules

.next
**/.next

dist
**/dist

coverage
**/coverage

*.log
**/*.log

.DS_Store
**/.DS_Store

.context/
dataflow/
deploy/
scripts/
tests/
.github/
20 changes: 13 additions & 7 deletions .github/workflows/build-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@ jobs:
with:
version: v3.17.3
- name: Validate chart and entrypoint
working-directory: ${{ inputs.source }}/database/deploy
env:
SOURCE: ${{ inputs.source }}
run: |
set -euo pipefail
bash -n database-frontend-entrypoint.sh
helm lint charts/database-frontend
helm template dbprovider-frontend charts/database-frontend --namespace dbprovider-frontend > /dev/null
python3 ../../../tests/test_deployment_compatibility.py
case "$SOURCE" in
main) deploy_dir=database/deploy ;;
release-v5.1) deploy_dir=deploy/kubeblocks-0.8 ;;
*) exit 1 ;;
esac
bash -n "$deploy_dir/database-frontend-entrypoint.sh"
helm lint "$deploy_dir/charts/database-frontend"
helm template dbprovider-frontend "$deploy_dir/charts/database-frontend" --namespace dbprovider-frontend > /dev/null
python3 tests/test_deployment_compatibility.py
- name: Validate DataFlow and combined installer
run: |
python3 scripts/test-bundle.py
Expand Down Expand Up @@ -93,8 +99,8 @@ jobs:
- name: Build runtime image (${{ matrix.arch }})
uses: docker/build-push-action@v6
with:
context: ./${{ inputs.source }}
file: ./${{ inputs.source }}/Dockerfile
context: .
file: ./Dockerfile
build-args: |
name=database
path=database
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
workflow_dispatch:
inputs:
publish_images:
description: Publish runtime and cluster images for both source trees
description: Publish runtime and cluster images for both deployment profiles
type: boolean
default: false
upload_oss:
Expand All @@ -26,7 +26,24 @@
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
compatibility:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.20.2'
- uses: azure/setup-helm@v4
with:
version: v3.17.3
- run: corepack enable && corepack prepare pnpm@8.9.0 --activate
- run: pnpm install --frozen-lockfile
- run: pnpm --dir database typecheck
- run: pnpm --dir database test:ci
- run: node --test tests/test_*.cjs

versions:
needs: compatibility
strategy:
fail-fast: false
matrix:
Expand Down
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules/
.next
.env*.local
next-env.d.ts
!.vscode/
.vscode/tasks.json
.claude
.agents
skills-lock.json
.omx
AGENTS.md
.sisyphus
**/test-results/
.codegraph/

.context/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 86 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright © 2022 sealos.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM node:20.20.2-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app

# Install dependencies only when needed
FROM base AS deps

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat && corepack enable && corepack prepare pnpm@8.9.0 --activate


# Install dependencies based on the preferred package manager root workspace
COPY pnpm-lock.yaml package.json pnpm-workspace.yaml ./

RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
[ -f pnpm-lock.yaml ] && pnpm fetch || \
(echo "Lockfile not found." && exit 1)
COPY ./tsconfig.json ./tsconfig.json
COPY ./tsconfig.deps.json ./tsconfig.deps.json
COPY ./tsconfig.base.json ./tsconfig.base.json
COPY ./tsconfig.web.json ./tsconfig.web.json


FROM deps AS builder

# COPY --from=deps /app/node_modules ./node_modules
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED=1


ARG name
ARG path

COPY ${path} ${path}

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm --frozen-lockfile --offline install && \
pnpm --filter=$name run build

# Production image, copy all the files and run next
FROM base AS runner

ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED=1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# OpenSSL: https://github.com/prisma/prisma/discussions/19341#discussioncomment-11521367
RUN apk add curl openssl ca-certificates dumb-init --no-cache \
&& update-ca-certificates

ARG name
ARG path

USER nextjs

# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/$path/next.config.js ./$path/next.config.js
COPY --from=builder /app/$path/public ./$path/public
COPY --from=builder --chown=nextjs:nodejs /app/$path/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/$path/.next/static ./$path/.next/static

EXPOSE 3000

ENV PORT=3000

ENV launchpath=./${path}/server.js

ENTRYPOINT ["dumb-init", "sh", "-c", "node ${launchpath}"]
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
DOCKER_USERNAME ?=
IMAGE_TAG ?= dev
PLATFORMS ?= linux/amd64,linux/arm64
IMAGE := $(if $(DOCKER_USERNAME),$(DOCKER_USERNAME)/)sealos-database:$(IMAGE_TAG)

.PHONY: all push-images fetch-deps build-database dev-database image-build-database image-push-database
all: image-build-database
push-images: image-push-database
fetch-deps:
pnpm fetch
build-database: fetch-deps
pnpm --offline --frozen-lockfile install
pnpm --filter ./database run build
dev-database: fetch-deps
pnpm --offline --frozen-lockfile install
pnpm --filter ./database run dev
image-build-database:
docker buildx build --platform=$(PLATFORMS) -t $(IMAGE) --build-arg path=database --build-arg name=database .
image-push-database:
docker buildx build --platform=$(PLATFORMS) --push -t $(IMAGE) --build-arg path=database --build-arg name=database .
Loading
Loading