mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:57:33 +00:00
cleanup package dockerfiles
This commit is contained in:
@@ -11,25 +11,25 @@ variable "DOCKERFILES_DIR" {
|
|||||||
# By default the platforms property is empty, so images are only built for the current bake runtime platform.
|
# By default the platforms property is empty, so images are only built for the current bake runtime platform.
|
||||||
target "release" {}
|
target "release" {}
|
||||||
|
|
||||||
# typescript-proto-client is used to generate the client code for the login service.
|
# login-zitadel-proto generates the @zitadel/proto package from protobuf files.
|
||||||
# It is not login-prefixed, so it is easily extendable.
|
# It generates TypeScript definitions from protobuf files.
|
||||||
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
|
# To extend this bake-file.hcl, set the context of all login-prefixed targets to a different directory.
|
||||||
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
|
# For example docker bake --file login/docker-bake.hcl --file docker-bake.hcl --set login-*.context=./login/
|
||||||
# The zitadel repository uses this to generate the client and the mock server from local proto files.
|
# The zitadel repository uses this to generate the client and the mock server from local proto files.
|
||||||
target "typescript-proto-client" {
|
target "login-zitadel-proto" {
|
||||||
inherits = ["release"]
|
inherits = ["release"]
|
||||||
dockerfile = "${DOCKERFILES_DIR}typescript-proto-client.Dockerfile"
|
dockerfile = "${DOCKERFILES_DIR}login-zitadel-proto.Dockerfile"
|
||||||
contexts = {
|
contexts = {
|
||||||
# We directly generate and download the client server-side with buf, so we don't need the proto files
|
# We directly generate and download the client server-side with buf, so we don't need the proto files
|
||||||
login-pnpm = "target:login-pnpm"
|
login-pnpm = "target:login-pnpm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# We prefix the target with login- so we can reuse the writing of protos if we overwrite the typescript-proto-client target.
|
# We prefix the target with login- so we can reuse the writing of protos if we overwrite the login-zitadel-proto target.
|
||||||
target "login-typescript-proto-client-out" {
|
target "login-zitadel-proto-out" {
|
||||||
dockerfile = "${DOCKERFILES_DIR}login-typescript-proto-client-out.Dockerfile"
|
dockerfile = "${DOCKERFILES_DIR}login-zitadel-proto-out.Dockerfile"
|
||||||
contexts = {
|
contexts = {
|
||||||
typescript-proto-client = "target:typescript-proto-client"
|
login-zitadel-proto = "target:login-zitadel-proto"
|
||||||
}
|
}
|
||||||
output = [
|
output = [
|
||||||
"type=local,dest=${LOGIN_DIR}packages/zitadel-proto"
|
"type=local,dest=${LOGIN_DIR}packages/zitadel-proto"
|
||||||
@@ -87,16 +87,16 @@ target "login-lint" {
|
|||||||
target "login-test-unit" {
|
target "login-test-unit" {
|
||||||
dockerfile = "${DOCKERFILES_DIR}login-test-unit.Dockerfile"
|
dockerfile = "${DOCKERFILES_DIR}login-test-unit.Dockerfile"
|
||||||
contexts = {
|
contexts = {
|
||||||
login-client = "target:login-client"
|
login-zitadel-client = "target:login-zitadel-client"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target "login-client" {
|
target "login-zitadel-client" {
|
||||||
inherits = ["release"]
|
inherits = ["release"]
|
||||||
dockerfile = "${DOCKERFILES_DIR}login-client.Dockerfile"
|
dockerfile = "${DOCKERFILES_DIR}login-zitadel-client.Dockerfile"
|
||||||
contexts = {
|
contexts = {
|
||||||
login-pnpm = "target:login-pnpm"
|
login-build-base = "target:login-build-base"
|
||||||
typescript-proto-client = "target:typescript-proto-client"
|
login-zitadel-proto = "target:login-zitadel-proto"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ target "login-standalone" {
|
|||||||
]
|
]
|
||||||
dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile"
|
dockerfile = "${DOCKERFILES_DIR}login-standalone.Dockerfile"
|
||||||
contexts = {
|
contexts = {
|
||||||
login-client = "target:login-client"
|
login-zitadel-client = "target:login-zitadel-client"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
FROM typescript-proto-client AS login-client
|
|
||||||
# Copy package.json first for better dependency caching
|
|
||||||
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 source code
|
|
||||||
COPY packages/zitadel-client ./packages/zitadel-client
|
|
||||||
# Build the client (equivalent to turbo build for zitadel-client)
|
|
||||||
RUN cd packages/zitadel-client && pnpm build
|
|
@@ -1,4 +1,4 @@
|
|||||||
FROM login-client AS login-standalone-builder
|
FROM login-zitadel-client AS login-standalone-builder
|
||||||
# Copy package.json files first for better dependency caching
|
# Copy package.json files first for better dependency caching
|
||||||
COPY apps/login/package.json ./apps/login/
|
COPY apps/login/package.json ./apps/login/
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
FROM login-pnpm AS login-test-acceptance-dependencies
|
FROM login-pnpm AS login-test-acceptance-dependencies
|
||||||
|
|
||||||
|
# Install dependencies with proper caching
|
||||||
COPY ./apps/login-test-acceptance/package.json ./apps/login-test-acceptance/package.json
|
COPY ./apps/login-test-acceptance/package.json ./apps/login-test-acceptance/package.json
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
pnpm install --frozen-lockfile --filter=login-test-acceptance && \
|
pnpm install --frozen-lockfile --filter=login-test-acceptance && \
|
||||||
cd apps/login-test-acceptance && \
|
cd apps/login-test-acceptance && \
|
||||||
pnpm exec playwright install --with-deps chromium
|
pnpm exec playwright install --with-deps chromium
|
||||||
|
|
||||||
|
# Copy source code (separate layer for better caching)
|
||||||
COPY ./apps/login-test-acceptance ./apps/login-test-acceptance
|
COPY ./apps/login-test-acceptance ./apps/login-test-acceptance
|
||||||
|
|
||||||
|
# Run acceptance tests (equivalent to turbo test:acceptance)
|
||||||
CMD ["bash", "-c", "cd apps/login-test-acceptance && pnpm test:acceptance test"]
|
CMD ["bash", "-c", "cd apps/login-test-acceptance && pnpm test:acceptance test"]
|
||||||
|
@@ -1,5 +1,23 @@
|
|||||||
|
# .dockerignore for login-test-acceptance
|
||||||
*
|
*
|
||||||
!/apps/login-test-acceptance/*.json
|
!/apps/login-test-acceptance/*.json
|
||||||
!/apps/login-test-acceptance/*.ts
|
!/apps/login-test-acceptance/*.ts
|
||||||
!/apps/login-test-acceptance/zitadel.yaml
|
!/apps/login-test-acceptance/zitadel.yaml
|
||||||
!/apps/login-test-acceptance/tests
|
!/apps/login-test-acceptance/tests
|
||||||
|
|
||||||
|
# Exclude turbo cache and other build artifacts
|
||||||
|
**/.turbo
|
||||||
|
**/.next
|
||||||
|
**/node_modules
|
||||||
|
**/dist
|
||||||
|
**/build
|
||||||
|
**/*.log
|
||||||
|
**/.git
|
||||||
|
**/coverage
|
||||||
|
**/.nyc_output
|
||||||
|
**/cypress/videos
|
||||||
|
**/cypress/screenshots
|
||||||
|
**/playwright-report
|
||||||
|
**/test-results
|
||||||
|
**/.env.local
|
||||||
|
**/.env.*.local
|
||||||
|
@@ -1,11 +1,22 @@
|
|||||||
FROM login-pnpm AS login-test-integration-dependencies
|
FROM login-pnpm AS login-test-integration-dependencies
|
||||||
|
|
||||||
|
# Install dependencies with proper caching
|
||||||
COPY ./apps/login-test-integration/package.json ./apps/login-test-integration/package.json
|
COPY ./apps/login-test-integration/package.json ./apps/login-test-integration/package.json
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
pnpm install --frozen-lockfile --filter=login-test-integration
|
pnpm install --frozen-lockfile --filter=login-test-integration
|
||||||
|
|
||||||
FROM cypress/factory:5.10.0 AS login-test-integration
|
FROM cypress/factory:5.10.0 AS login-test-integration
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
|
# Copy built dependencies
|
||||||
COPY --from=login-test-integration-dependencies /build/apps/login-test-integration .
|
COPY --from=login-test-integration-dependencies /build/apps/login-test-integration .
|
||||||
|
|
||||||
|
# Install Cypress with caching
|
||||||
RUN npm install cypress
|
RUN npm install cypress
|
||||||
RUN npx cypress install
|
RUN npx cypress install
|
||||||
|
|
||||||
|
# Copy source code (separate layer for better caching)
|
||||||
COPY ./apps/login-test-integration .
|
COPY ./apps/login-test-integration .
|
||||||
|
|
||||||
|
# Run integration tests (equivalent to turbo test:integration)
|
||||||
CMD ["npx", "cypress", "run"]
|
CMD ["npx", "cypress", "run"]
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
FROM login-client AS login-test-unit
|
FROM login-zitadel-client AS login-test-unit
|
||||||
# Copy package.json first for better dependency caching
|
# Copy package.json first for better dependency caching
|
||||||
COPY apps/login/package.json ./apps/login/
|
COPY apps/login/package.json ./apps/login/
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
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
|
|
@@ -1 +0,0 @@
|
|||||||
*
|
|
18
login/dockerfiles/login-zitadel-client.Dockerfile
Normal file
18
login/dockerfiles/login-zitadel-client.Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM login-build-base AS login-client-dependencies
|
||||||
|
# Copy package.json first for better dependency caching
|
||||||
|
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
|
||||||
|
|
||||||
|
FROM login-zitadel-proto AS login-zitadel-client
|
||||||
|
# Copy dependencies from build base
|
||||||
|
COPY --from=login-client-dependencies /build/node_modules ./node_modules
|
||||||
|
COPY --from=login-client-dependencies /build/packages/zitadel-client/node_modules ./packages/zitadel-client/node_modules
|
||||||
|
|
||||||
|
# Copy generated proto files (@zitadel/proto package)
|
||||||
|
COPY --from=login-zitadel-proto /build/packages/zitadel-proto ./packages/zitadel-proto
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY packages/zitadel-client ./packages/zitadel-client
|
||||||
|
# Build the @zitadel/client package (equivalent to turbo build for zitadel-client)
|
||||||
|
RUN cd packages/zitadel-client && pnpm build
|
5
login/dockerfiles/login-zitadel-proto-out.Dockerfile
Normal file
5
login/dockerfiles/login-zitadel-proto-out.Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
FROM scratch AS login-zitadel-proto-out
|
||||||
|
COPY --from=login-zitadel-proto /build/packages/zitadel-proto/zitadel /zitadel
|
||||||
|
COPY --from=login-zitadel-proto /build/packages/zitadel-proto/google /google
|
||||||
|
COPY --from=login-zitadel-proto /build/packages/zitadel-proto/protoc-gen-openapiv2 /protoc-gen-openapiv2
|
||||||
|
COPY --from=login-zitadel-proto /build/packages/zitadel-proto/validate /validate
|
@@ -1,9 +1,9 @@
|
|||||||
FROM login-pnpm AS typescript-proto-client
|
FROM login-pnpm AS login-zitadel-proto
|
||||||
# Copy package.json first for better dependency caching
|
# Copy package.json first for better dependency caching
|
||||||
COPY packages/zitadel-proto/package.json ./packages/zitadel-proto/
|
COPY packages/zitadel-proto/package.json ./packages/zitadel-proto/
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
pnpm install --frozen-lockfile --workspace-root --filter zitadel-proto
|
pnpm install --frozen-lockfile --workspace-root --filter zitadel-proto
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY packages/zitadel-proto ./packages/zitadel-proto
|
COPY packages/zitadel-proto ./packages/zitadel-proto
|
||||||
# Generate proto files (equivalent to turbo generate)
|
# Generate @zitadel/proto package - equivalent to turbo generate
|
||||||
RUN cd packages/zitadel-proto && pnpm generate
|
RUN cd packages/zitadel-proto && pnpm generate
|
Reference in New Issue
Block a user