This commit is contained in:
Florian Forster
2025-08-05 13:54:23 -07:00
parent c33a79459b
commit 3e437575c2
13 changed files with 267 additions and 36 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM debian:latest AS artifact
ENV ZITADEL_ARGS=
ARG TARGETPLATFORM
RUN apt-get update && apt-get install ca-certificates -y
COPY entrypoint.sh /app/entrypoint.sh
COPY zitadel /app/zitadel
RUN useradd -s "" --home / zitadel && \
chown zitadel /app/zitadel && \
chmod +x /app/zitadel && \
chown zitadel /app/entrypoint.sh && \
chmod +x /app/entrypoint.sh
WORKDIR /app
ENV PATH="/app:${PATH}"
USER zitadel
ENTRYPOINT ["/app/entrypoint.sh"]
FROM scratch AS final
ARG TARGETPLATFORM
COPY --from=artifact /etc/passwd /etc/passwd
COPY --from=artifact /etc/ssl/certs /etc/ssl/certs
COPY --from=artifact /app/zitadel /app/zitadel
HEALTHCHECK NONE
EXPOSE 8080
USER zitadel
ENTRYPOINT ["/app/zitadel"]

11
apps/console/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM nginx:1.29.0
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
USER nginx
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
# TODO Needs work to be configured for the console app
COPY --chown=nginx:nginx dist/console /usr/share/nginx/html
EXPOSE 3001
ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"]
CMD ["-g", "daemon off;"]

69
apps/console/nginx.conf Normal file
View File

@@ -0,0 +1,69 @@
worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log off;
error_log /dev/stderr warn;
# Performance
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 1000;
# Compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_min_length 256;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
font/ttf
font/otf
image/svg+xml;
server {
listen 3001;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Angular Routing
location / {
try_files $uri $uri/ /index.html;
}
# Static Assets Caching
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|map)$ {
expires 1y;
access_log off;
add_header Cache-Control "public, immutable";
}
# Optional: Explicit asset route
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}

View File

@@ -11,15 +11,15 @@
"lint:check:prettier": "prettier --check src", "lint:check:prettier": "prettier --check src",
"lint:fix": "prettier --write src", "lint:fix": "prettier --write src",
"generate": "pnpm exec buf generate ../../proto --include-imports --include-wkt", "generate": "pnpm exec buf generate ../../proto --include-imports --include-wkt",
"clean": "rm -rf dist .angular .turbo node_modules src/app/proto/generated" "clean": "rm -rf dist .angular node_modules src/app/proto/generated"
}, },
"nx": { "nx": {
"targets": {
"release": { "release": {
"docker": { "docker": {
"repositoryName": "zitadel/console" "repositoryName": "zitadel/console"
} }
}, },
"targets": {
"generate": { "generate": {
"outputs": [ "outputs": [
"{projectRoot}/src/app/proto/generated/**" "{projectRoot}/src/app/proto/generated/**"
@@ -33,6 +33,17 @@
"generate", "generate",
"@zitadel/client:build" "@zitadel/client:build"
] ]
},
"docker:build": {
"dependsOn": ["build"]
},
"docker:run": {
"options": {
"args": [
"-p",
"3001:3001"
]
}
} }
} }
}, },

View File

@@ -1,21 +0,0 @@
*
!constants
!scripts
!src
!public
!locales
!next.config.mjs
!next-env-vars.d.ts
!next-env.d.ts
!tailwind.config.js
!tsconfig.json
!package.json
!pnpm-lock.yaml
**/*.md
**/*.png
**/node_modules
**/.turbo
**/*.test.ts
**/*.test.tsx

View File

@@ -9,16 +9,15 @@ ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs RUN adduser --system --uid 1001 nextjs
COPY public ./public COPY --chown=nextjs:nodejs public ./public
COPY .next/standalone ./ COPY --chown=nextjs:nodejs .next/standalone/ ./
COPY .next/static ./.next/static COPY --chown=nextjs:nodejs .next/static ./.next/static
RUN ls .next/static
USER nextjs USER nextjs
EXPOSE 3000 EXPOSE 3002
ENV PORT=3000 ENV PORT=3002
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"] CMD ["node", "./apps/login/server.js"]

View File

@@ -58,6 +58,19 @@
"dependsOn": [ "dependsOn": [
"@zitadel/client#build" "@zitadel/client#build"
] ]
},
"docker:build": {
"dependsOn": [
"build:login:standalone"
]
},
"docker:run": {
"options": {
"args": [
"-p",
"3002:3002"
]
}
} }
} }
}, },

17
entrypoint.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
case $@ in
sh*)
${@:3}
;;
bash*)
${@:5}
;;
*)
if [[ ! -z "$@" ]]
then
ZITADEL_ARGS="$@"
fi
/app/zitadel ${ZITADEL_ARGS}
;;
esac

53
hodor/package.json Normal file
View File

@@ -0,0 +1,53 @@
{
"packageManager": "pnpm@9.1.2+sha256.19c17528f9ca20bd442e4ca42f00f1b9808a9cb419383cd04ba32ef19322aba7",
"private": true,
"name": "@zitadel/api",
"scripts": {
"build": "make compile"
},
"nx": {
"release": {
"docker": {
"repositoryName": "zitadel/zitadel"
}
},
"targets": {
"build": {
"outputs": [
"{workspaceRoot}/zitadel"
],
"dependsOn": [
"@zitadel/console:build"
]
},
"docker:build": {
"dependsOn": [
"build"
]
},
"docker:run": {
"options": {
"args": [
"-p",
"3000:3000"
]
}
}
}
},
"pnpm": {
"overrides": {
"@typescript-eslint/parser": "^8.35.1",
"@zitadel/client": "workspace:*",
"@zitadel/proto": "workspace:*"
}
},
"devDependencies": {
"@bufbuild/buf": "^1.55.1",
"@changesets/cli": "^2.29.5",
"@devcontainers/cli": "^0.80.0",
"@nx/docker": "21.4.0-beta.5",
"nx": "21.4.0-beta.5",
"sass": "1.64.1"
}
}

View File

@@ -4,7 +4,7 @@
"releaseTagPattern": "release/{projectName}/{version}", "releaseTagPattern": "release/{projectName}/{version}",
"groups": { "groups": {
"test": { "test": {
"projects": ["@zitadel/login", "@zitadel/console"], "projects": ["@zitadel/login", "@zitadel/console", "@zitadel/api"],
"projectsRelationship": "fixed", "projectsRelationship": "fixed",
"docker": { "docker": {
"skipVersionActions": true, "skipVersionActions": true,

View File

@@ -6,6 +6,11 @@
"build": "make compile" "build": "make compile"
}, },
"nx": { "nx": {
"release": {
"docker": {
"repositoryName": "zitadel/zitadel"
}
},
"targets": { "targets": {
"build": { "build": {
"outputs": [ "outputs": [
@@ -14,6 +19,25 @@
"dependsOn": [ "dependsOn": [
"@zitadel/console:build" "@zitadel/console:build"
] ]
},
"docker:build": {
"dependsOn": [
"build"
],
"options": {
"push": false,
"tags": [
"zitadel/zitadel:latest"
]
}
},
"docker:run": {
"options": {
"args": [
"-p",
"3000:3000"
]
}
} }
} }
}, },

21
pnpm-lock.yaml generated
View File

@@ -591,6 +591,27 @@ importers:
specifier: ^13.13.3 specifier: ^13.13.3
version: 13.17.0 version: 13.17.0
hodor:
devDependencies:
'@bufbuild/buf':
specifier: ^1.55.1
version: 1.55.1
'@changesets/cli':
specifier: ^2.29.5
version: 2.29.5
'@devcontainers/cli':
specifier: ^0.80.0
version: 0.80.0
'@nx/docker':
specifier: 21.4.0-beta.5
version: 21.4.0-beta.5(nx@21.4.0-beta.5(@swc/core@1.13.3))
nx:
specifier: 21.4.0-beta.5
version: 21.4.0-beta.5(@swc/core@1.13.3)
sass:
specifier: 1.64.1
version: 1.64.1
packages/zitadel-client: packages/zitadel-client:
dependencies: dependencies:
'@bufbuild/protobuf': '@bufbuild/protobuf':

View File

@@ -3,3 +3,4 @@ packages:
- "e2e" - "e2e"
- "packages/*" - "packages/*"
- "apps/*" - "apps/*"
- "hodor"