mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 16:17:32 +00:00
bake
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
/*
|
||||
!/docker
|
||||
.git
|
||||
node_modules
|
||||
|
18
Dockerfile
18
Dockerfile
@@ -1,18 +0,0 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# If /.env-file/.env is mounted into the container, its variables are made available to the server before it starts up.
|
||||
RUN mkdir -p /.env-file && touch /.env-file/.env && chown -R nextjs:nodejs /.env-file
|
||||
|
||||
COPY --chown=nextjs:nodejs ./docker/apps/login/.next/standalone ./
|
||||
COPY --chown=nextjs:nodejs ./docker/apps/login/.next/static ./apps/login/.next/static
|
||||
COPY --chown=nextjs:nodejs ./docker/apps/login/public ./apps/login/public
|
||||
|
||||
USER nextjs
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
CMD ["/bin/sh", "-c", " set -o allexport && . /.env-file/.env && set +o allexport && node apps/login/server.js"]
|
@@ -3,30 +3,30 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"test": "concurrently --timings --kill-others-on-fail 'npm:test:unit' 'npm:test:integration'",
|
||||
"test:watch": "concurrently --kill-others 'npm:test:unit:watch' 'npm:test:integration:watch'",
|
||||
"test:unit": "vitest",
|
||||
"dev": "pnpm exec next dev --turbopack",
|
||||
"test": "pnpm exec concurrently --timings --kill-others-on-fail 'npm:test:unit' 'npm:test:integration'",
|
||||
"test:watch": "cpnpm exec oncurrently --kill-others 'npm:test:unit:watch' 'npm:test:integration:watch'",
|
||||
"test:unit": "pnpm exec vitest",
|
||||
"test:unit:watch": "pnpm test:unit --watch",
|
||||
"test:integration": "pnpm mock:build && concurrently --names 'mock,test' --success command-test --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test start http://localhost:3000 \"test:integration:run\"'",
|
||||
"test:integration:watch:run": "concurrently --names 'mock,test' --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:run\\\"\"'",
|
||||
"test:integration:watch:open": "concurrently --names 'mock,test' --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:open\\\"\"'",
|
||||
"test:integration:run": "cypress run --config-file ./cypress/cypress.config.ts --quiet",
|
||||
"test:integration:open": "cypress open --config-file ./cypress/cypress.config.ts",
|
||||
"test:integration": "pnpm mock:build && pnpm exec concurrently --names 'mock,test' --success command-test --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test start http://localhost:3000 \"test:integration:run\"'",
|
||||
"test:integration:watch:run": "pnpm exec concurrently --names 'mock,test' --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:run\\\"\"'",
|
||||
"test:integration:watch:open": "pnpm exec concurrently --names 'mock,test' --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:open\\\"\"'",
|
||||
"test:integration:run": "pnpm exec cypress run --config-file ./cypress/cypress.config.ts --quiet",
|
||||
"test:integration:open": "pnpm exec cypress open --config-file ./cypress/cypress.config.ts",
|
||||
"mock": "pnpm mock:build && pnpm mock:run",
|
||||
"mock:run": "pnpm mock:stop && docker run --rm --name zitadel-mock-grpc-server --publish 22220:22220 --publish 22222:22222 zitadel-mock-grpc-server",
|
||||
"mock:build": "DOCKER_BUILDKIT=1 docker build --tag zitadel-mock-grpc-server ./mock",
|
||||
"mock:build:nocache": "pnpm mock:build --no-cache",
|
||||
"mock:stop": "docker rm --force zitadel-mock-grpc-server 2>/dev/null || true",
|
||||
"mock:destroy": "docker rmi --force zitadel-mock-grpc-server 2>/dev/null || true",
|
||||
"lint": "next lint && prettier --check .",
|
||||
"lint:fix": "prettier --write .",
|
||||
"lint": "pnpm exec next lint && pnpm exec prettier --check .",
|
||||
"lint:fix": "pnpm exec prettier --write .",
|
||||
"lint-staged": "lint-staged",
|
||||
"build": "next build",
|
||||
"build": "pnpm exec next build",
|
||||
"build:standalone": "NEXT_OUTPUT_MODE=standalone pnpm build",
|
||||
"prestart": "pnpm build",
|
||||
"start": "next start",
|
||||
"start:built": "next start",
|
||||
"start": "pnpm exec next start",
|
||||
"start:built": "pnpm exec next start",
|
||||
"clean": "pnpm mock:destroy && rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"git": {
|
||||
|
30
bake/base.Dockerfile
Normal file
30
bake/base.Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
# BUILD STAGE
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache libc6-compat bash git
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
# Copy remote turbo.json config for pruning
|
||||
COPY turbo.json ./
|
||||
COPY .npmrc ./
|
||||
|
||||
# pnpm store + turbo build cache
|
||||
RUN mkdir -p .pnpm-store .next
|
||||
|
||||
# Copy just lockfile & manifests for better cache-hit
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
COPY packages/zitadel-client/package.json ./packages/zitadel-client/
|
||||
COPY packages/zitadel-eslint-config/package.json ./packages/zitadel-eslint-config/
|
||||
COPY packages/zitadel-prettier-config/package.json ./packages/zitadel-prettier-config/
|
||||
COPY packages/zitadel-proto/package.json ./packages/zitadel-proto/
|
||||
COPY packages/zitadel-tailwind-config/package.json ./packages/zitadel-tailwind-config/
|
||||
COPY packages/zitadel-tsconfig/package.json ./packages/zitadel-tsconfig/
|
||||
COPY apps/login/package.json ./apps/login/
|
||||
|
||||
RUN --mount=type=cache,target=/app/.pnpm-store \
|
||||
pnpm install --frozen-lockfile --store-dir .pnpm-store
|
||||
|
||||
# Full source
|
||||
COPY . .
|
24
bake/login-for-docker.Dockerfile
Normal file
24
bake/login-for-docker.Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
# BUILD STAGE
|
||||
FROM proto AS build-for-docker
|
||||
|
||||
RUN NEXT_PUBLIC_BASE_PATH=/ui/v2/login pnpm build:docker
|
||||
|
||||
# RUNTIME
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
# If /.env-file/.env is mounted into the container, its variables are made available to the server before it starts up.
|
||||
RUN mkdir -p /.env-file && touch /.env-file/.env && chown -R nextjs:nodejs /.env-file
|
||||
|
||||
COPY --chown=nextjs:nodejs --from=build-for-docker /app/docker/apps/login/.next/standalone ./
|
||||
COPY --chown=nextjs:nodejs --from=build-for-docker /app/docker/apps/login/.next/static ./apps/login/.next/static
|
||||
COPY --chown=nextjs:nodejs --from=build-for-docker /app/docker/apps/login/public ./apps/login/public
|
||||
|
||||
USER nextjs
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
CMD ["/bin/sh", "-c", " set -o allexport && . /.env-file/.env && set +o allexport && node apps/login/server.js"]
|
4
bake/proto.Dockerfile
Normal file
4
bake/proto.Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
||||
# BUILD STAGE
|
||||
FROM base
|
||||
|
||||
RUN pnpm generate
|
37
docker-bake.hcl
Normal file
37
docker-bake.hcl
Normal file
@@ -0,0 +1,37 @@
|
||||
variable "tags" {
|
||||
default = ["zitadel-login:local"]
|
||||
}
|
||||
|
||||
variable "login-context" {
|
||||
default = "."
|
||||
}
|
||||
|
||||
group "default" {
|
||||
targets = ["login-docker-image"]
|
||||
}
|
||||
|
||||
target "typescript-base" {
|
||||
context = "${login-context}"
|
||||
dockerfile = "bake/base.Dockerfile"
|
||||
}
|
||||
|
||||
target "proto" {
|
||||
context = "${login-context}"
|
||||
dockerfile = "bake/proto.Dockerfile"
|
||||
output = ["type=local,dest=./packages/zitadel-proto"]
|
||||
contexts = {
|
||||
base = "target:typescript-base"
|
||||
}
|
||||
}
|
||||
|
||||
target "login-docker-image" {
|
||||
context = "${login-context}"
|
||||
dockerfile = "bake/login-for-docker.Dockerfile"
|
||||
tags = "${tags}"
|
||||
args = {
|
||||
NODE_ENV = "production"
|
||||
}
|
||||
contexts = {
|
||||
proto = "target:proto"
|
||||
}
|
||||
}
|
40
package.json
40
package.json
@@ -3,27 +3,27 @@
|
||||
"private": true,
|
||||
"name": "typescript-monorepo",
|
||||
"scripts": {
|
||||
"generate": "turbo run generate",
|
||||
"build": "turbo run build",
|
||||
"build:docker": "rm -rf ./out ./docker && turbo run build --filter=./packages/zitadel-client && turbo prune @zitadel/login --docker && mkdir -p ./docker && cd ./docker && cp -r ../out/json/* . && pnpm install --frozen-lockfile && cp -r ../out/full/* . && turbo run build:standalone && cd ..",
|
||||
"build:packages": "turbo run build --filter=./packages/*",
|
||||
"build:apps": "turbo run build --filter=./apps/*",
|
||||
"test": "turbo run test",
|
||||
"start": "turbo run start",
|
||||
"start:built": "turbo run start:built",
|
||||
"test:unit": "turbo run test:unit -- --passWithNoTests",
|
||||
"test:integration": "turbo run test:integration",
|
||||
"generate": "pnpm exec turbo run generate",
|
||||
"build": "pnpm exec turbo run build",
|
||||
"build:docker": "rm -rf ./out ./docker && pnpm exec turbo run build --filter=./packages/zitadel-client && pnpm exec turbo prune @zitadel/login --docker && mkdir -p ./docker && cd ./docker && cp -r ../out/json/* . && pnpm install --frozen-lockfile && cp -r ../out/full/* . && pnpm exec turbo run build:standalone && cd ..",
|
||||
"build:packages": "pnpm exec turbo run build --filter=./packages/*",
|
||||
"build:apps": "pnpm exec turbo run build --filter=./apps/*",
|
||||
"test": "pnpm exec turbo run test",
|
||||
"start": "pnpm exec turbo run start",
|
||||
"start:built": "pnpm exec turbo run start:built",
|
||||
"test:unit": "pnpm exec turbo run test:unit -- --passWithNoTests",
|
||||
"test:integration": "pnpm exec turbo run test:integration",
|
||||
"test:acceptance": "pnpm exec playwright test",
|
||||
"test:watch": "turbo run test:watch",
|
||||
"dev": "turbo run dev --no-cache --continue",
|
||||
"lint": "turbo run lint",
|
||||
"lint:fix": "turbo run lint:fix",
|
||||
"clean": "turbo run clean && rm -rf node_modules",
|
||||
"format:fix": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||
"format": "prettier --check \"**/*.{ts,tsx,md}\"",
|
||||
"changeset": "changeset",
|
||||
"version-packages": "changeset version",
|
||||
"release": "turbo run build --filter=login^... && changeset publish",
|
||||
"test:watch": "pnpm exec turbo run test:watch",
|
||||
"dev": "pnpm exec turbo run dev --no-cache --continue",
|
||||
"lint": "pnpm exec turbo run lint",
|
||||
"lint:fix": "pnpm exec turbo run lint:fix",
|
||||
"clean": "pnpm exec turbo run clean && rm -rf node_modules",
|
||||
"format:fix": "pnpm exec prettier --write \"**/*.{ts,tsx,md}\"",
|
||||
"format": "pnpm exec prettier --check \"**/*.{ts,tsx,md}\"",
|
||||
"changeset": "pnpm exec changeset",
|
||||
"version-packages": "pnpm exec changeset version",
|
||||
"release": "pnpm exec turbo run build --filter=login^... && pnpm exec changeset publish",
|
||||
"run-zitadel": "docker compose -f ./acceptance/docker-compose.yaml run setup",
|
||||
"run-sink": "docker compose -f ./acceptance/docker-compose.yaml up -d sink",
|
||||
"run-samlsp": "docker compose -f ./acceptance/saml/docker-compose.yaml up -d",
|
||||
|
@@ -43,12 +43,12 @@
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "pnpm exec tsup",
|
||||
"test": "pnpm test:unit",
|
||||
"test:watch": "pnpm test:unit:watch",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:watch": "vitest --watch",
|
||||
"dev": "tsup --watch --dts",
|
||||
"test:unit": "pnpm exec vitest",
|
||||
"test:unit:watch": "pnpm exec vitest --watch",
|
||||
"dev": "pnpm exec tsup --watch --dts",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
||||
},
|
||||
|
@@ -14,7 +14,7 @@
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"generate": "buf generate https://github.com/zitadel/zitadel.git --path ./proto/zitadel",
|
||||
"generate": "pnpm exec buf generate https://github.com/zitadel/zitadel.git --path ./proto/zitadel",
|
||||
"clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate"
|
||||
},
|
||||
"dependencies": {
|
||||
|
Reference in New Issue
Block a user