mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 13:58:46 +00:00
chore(login): migrate nextjs login to monorepo (#10134)
# Which Problems Are Solved We move the login code to the zitadel repo. # How the Problems Are Solved The login repo is added to ./login as a git subtree pulled from the dockerize-ci branch. Apart from the login code, this PR contains the changes from #10116 # Additional Context - Closes https://github.com/zitadel/typescript/issues/474 - Also merges #10116 - Merging is blocked by failing check because of: - https://github.com/zitadel/zitadel/pull/10134#issuecomment-3012086106 --------- Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
co-authored by
Max Peintner
Max Peintner
Florian Forster
parent
fce9e770ac
commit
2928c6ac2b
@@ -0,0 +1,7 @@
|
||||
FROM typescript-proto-client AS login-client
|
||||
COPY packages/zitadel-tsconfig packages/zitadel-tsconfig
|
||||
COPY packages/zitadel-client/package.json ./packages/zitadel-client/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --workspace-root --filter ./packages/zitadel-client
|
||||
COPY packages/zitadel-client ./packages/zitadel-client
|
||||
RUN pnpm build:client:standalone
|
||||
@@ -0,0 +1,11 @@
|
||||
*
|
||||
|
||||
!packages/zitadel-client
|
||||
packages/zitadel-client/dist
|
||||
|
||||
!packages/zitadel-tsconfig
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM login-pnpm AS login-dev-base
|
||||
RUN pnpm install --frozen-lockfile --prefer-offline --workspace-root --filter .
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM login-dev-base AS login-lint
|
||||
COPY .prettierrc .prettierignore ./
|
||||
COPY apps/login/package.json apps/login/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --workspace-root --filter apps/login
|
||||
COPY . .
|
||||
RUN pnpm lint && pnpm format
|
||||
@@ -0,0 +1,25 @@
|
||||
*
|
||||
|
||||
!apps/login
|
||||
apps/login/.next
|
||||
apps/login/dist
|
||||
apps/login/screenshots
|
||||
apps/login/standalone
|
||||
apps/login/.env*.local
|
||||
|
||||
!apps/login-test-integration
|
||||
|
||||
!apps/login-test-acceptance
|
||||
apps/login-test-acceptance/test-results
|
||||
|
||||
!/packages/zitadel-tsconfig/*
|
||||
!/packages/zitadel-prettier-config
|
||||
!/packages/zitadel-eslint-config
|
||||
|
||||
!/.prettierrc
|
||||
!/.prettierignore
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
@@ -0,0 +1,10 @@
|
||||
ARG NODE_VERSION=20
|
||||
FROM node:${NODE_VERSION}-bookworm AS login-pnpm
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack prepare [email protected] --activate && \
|
||||
apt-get update && apt-get install -y --no-install-recommends && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /build
|
||||
COPY turbo.json .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
ENTRYPOINT ["pnpm"]
|
||||
@@ -0,0 +1,6 @@
|
||||
*
|
||||
!/turbo.json
|
||||
!/.npmrc
|
||||
!/package.json
|
||||
!/pnpm-lock.yaml
|
||||
!/pnpm-workspace.yaml
|
||||
@@ -0,0 +1,34 @@
|
||||
FROM login-client AS login-standalone-builder
|
||||
COPY apps/login ./apps/login
|
||||
COPY packages/zitadel-tailwind-config packages/zitadel-tailwind-config
|
||||
RUN pnpm exec turbo prune @zitadel/login --docker
|
||||
WORKDIR /build/docker
|
||||
RUN cp -r ../out/json/* .
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile
|
||||
RUN cp -r ../out/full/* .
|
||||
RUN pnpm exec turbo run build:login:standalone
|
||||
|
||||
FROM scratch AS login-standalone-out
|
||||
COPY --from=login-standalone-builder /build/docker/apps/login/.next/standalone /
|
||||
COPY --from=login-standalone-builder /build/docker/apps/login/.next/static /apps/login/.next/static
|
||||
COPY --from=login-standalone-builder /build/docker/apps/login/public /apps/login/public
|
||||
|
||||
FROM node:20-alpine AS login-standalone
|
||||
WORKDIR /runtime
|
||||
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 ./scripts/entrypoint.sh ./
|
||||
COPY ./scripts/healthcheck.js ./
|
||||
COPY --chown=nextjs:nodejs --from=login-standalone-builder /build/docker/apps/login/.next/standalone ./
|
||||
COPY --chown=nextjs:nodejs --from=login-standalone-builder /build/docker/apps/login/.next/static ./apps/login/.next/static
|
||||
COPY --chown=nextjs:nodejs --from=login-standalone-builder /build/docker/apps/login/public ./apps/login/public
|
||||
USER nextjs
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
ENV PORT=3000
|
||||
# TODO: Check healthy, not ready
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD ["/bin/sh", "-c", "node ./healthcheck.js http://localhost:${PORT}/ui/v2/login/healthy"]
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
@@ -0,0 +1,17 @@
|
||||
*
|
||||
|
||||
!apps/login
|
||||
apps/login/.next
|
||||
apps/login/dist
|
||||
apps/login/screenshots
|
||||
apps/login/standalone
|
||||
apps/login/.env*.local
|
||||
|
||||
!scripts/entrypoint.sh
|
||||
!scripts/healthcheck.js
|
||||
!packages/zitadel-tailwind-config
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM login-pnpm AS login-test-acceptance-dependencies
|
||||
COPY ./apps/login-test-acceptance/package.json ./apps/login-test-acceptance/package.json
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --filter=login-test-acceptance && \
|
||||
cd apps/login-test-acceptance && \
|
||||
pnpm exec playwright install --with-deps chromium
|
||||
COPY ./apps/login-test-acceptance ./apps/login-test-acceptance
|
||||
CMD ["bash", "-c", "cd apps/login-test-acceptance && pnpm test:acceptance test"]
|
||||
@@ -0,0 +1,5 @@
|
||||
*
|
||||
!/apps/login-test-acceptance/*.json
|
||||
!/apps/login-test-acceptance/*.ts
|
||||
!/apps/login-test-acceptance/zitadel.yaml
|
||||
!/apps/login-test-acceptance/tests
|
||||
@@ -0,0 +1,11 @@
|
||||
FROM login-pnpm AS login-test-integration-dependencies
|
||||
COPY ./apps/login-test-integration/package.json ./apps/login-test-integration/package.json
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --filter=login-test-integration
|
||||
FROM cypress/factory:5.10.0 AS login-test-integration
|
||||
WORKDIR /opt/app
|
||||
COPY --from=login-test-integration-dependencies /build/apps/login-test-integration .
|
||||
RUN npm install cypress
|
||||
RUN npx cypress install
|
||||
COPY ./apps/login-test-integration .
|
||||
CMD ["npx", "cypress", "run"]
|
||||
@@ -0,0 +1,9 @@
|
||||
*
|
||||
|
||||
!/apps/login-test-integration
|
||||
/apps/login-test-integration/core-mock
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM login-client AS login-test-unit
|
||||
COPY apps/login/package.json ./apps/login/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --workspace-root --filter ./apps/login
|
||||
COPY apps/login ./apps/login
|
||||
RUN pnpm test:unit:standalone
|
||||
@@ -0,0 +1,13 @@
|
||||
*
|
||||
|
||||
!apps/login
|
||||
apps/login/.next
|
||||
apps/login/dist
|
||||
apps/login/screenshots
|
||||
apps/login/standalone
|
||||
apps/login/.env*.local
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
@@ -0,0 +1,5 @@
|
||||
FROM scratch AS typescript-proto-client-out
|
||||
COPY --from=typescript-proto-client /build/packages/zitadel-proto/zitadel /zitadel
|
||||
COPY --from=typescript-proto-client /build/packages/zitadel-proto/google /google
|
||||
COPY --from=typescript-proto-client /build/packages/zitadel-proto/protoc-gen-openapiv2 /protoc-gen-openapiv2
|
||||
COPY --from=typescript-proto-client /build/packages/zitadel-proto/validate /validate
|
||||
@@ -0,0 +1 @@
|
||||
*
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM bufbuild/buf:1.54.0 AS proto-files
|
||||
RUN buf export https://github.com/envoyproxy/protoc-gen-validate.git --path validate --output /proto-files && \
|
||||
buf export https://github.com/grpc-ecosystem/grpc-gateway.git --path protoc-gen-openapiv2 --output /proto-files && \
|
||||
buf export https://github.com/googleapis/googleapis.git --path google/api/annotations.proto --path google/api/http.proto --path google/api/field_behavior.proto --output /proto-files && \
|
||||
buf export https://github.com/zitadel/zitadel.git --path ./proto/zitadel --output /proto-files
|
||||
|
||||
FROM scratch
|
||||
COPY --from=proto-files /proto-files /
|
||||
@@ -0,0 +1 @@
|
||||
*
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM login-pnpm AS typescript-proto-client
|
||||
COPY packages/zitadel-proto/package.json ./packages/zitadel-proto/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile --workspace-root --filter zitadel-proto
|
||||
COPY packages/zitadel-proto ./packages/zitadel-proto
|
||||
RUN pnpm generate
|
||||
@@ -0,0 +1,11 @@
|
||||
*
|
||||
!/packages/zitadel-proto/
|
||||
packages/zitadel-proto/google
|
||||
packages/zitadel-proto/zitadel
|
||||
packages/zitadel-proto/protoc-gen-openapiv2
|
||||
packages/zitadel-proto/validate
|
||||
|
||||
**/*.md
|
||||
**/*.png
|
||||
**/node_modules
|
||||
**/.turbo
|
||||
Reference in New Issue
Block a user