Skip to content

Commit 365cfe7

Browse files
fstreit1Manuel
andauthored
chore(frontend): fix local dev with keycloak #708
Co-authored-by: Manuel <moeri@puzzle.ch>
1 parent b3e24bf commit 365cfe7

8 files changed

Lines changed: 67 additions & 59 deletions

File tree

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
frontend/node_modules
2+
frontend/coverage
3+
frontend/.angular
4+
frontend/dist
5+
frontend/.pnpm-store

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# File-based project format
55
*.iws
6-
6+
parent.iml
77
# IntelliJ
88
out/
99

docker/docker-compose.e2e.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ services:
44
container_name: pcts-e2e-backend
55
environment:
66
SPRING_PROFILES_ACTIVE: e2e-test
7-
8-
pcts-frontend:
9-
build:
10-
args:
11-
BUILD_CONFIGURATION: development

docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ services:
4949
build:
5050
context: ..
5151
dockerfile: ./frontend/Dockerfile
52+
args:
53+
BUILD_CONFIGURATION: development
5254
ports:
5355
- "4200:4200"
5456
profiles: ['']

frontend/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
FROM node:24.18-alpine AS builder
22
WORKDIR /app
33
RUN corepack enable && corepack prepare pnpm@10.32.1 --activate
4+
ENV CI="true"
5+
ENV CYPRESS_INSTALL_BINARY=0
6+
7+
# 1. Copy ONLY the package files first to leverage Docker layer caching
48
COPY frontend/package.json frontend/pnpm-lock.yaml frontend/pnpm-workspace.yaml ./
9+
# 2. Install ALL dependencies (Angular needs devDependencies to build)
510
RUN pnpm install --frozen-lockfile
6-
COPY frontend ./
11+
# 3. Copy the rest of the source code
12+
COPY frontend/ ./
713
ARG BUILD_CONFIGURATION=production
8-
RUN pnpm run build --output-path=./dist/ --configuration=${BUILD_CONFIGURATION}
14+
RUN pnpm build --output-path=./dist/ --configuration=${BUILD_CONFIGURATION}
915

1016
FROM nginxinc/nginx-unprivileged:1.31-alpine AS runner
1117
COPY frontend/nginx.conf /etc/nginx/

frontend/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ http {
2222
sub_filter_once off;
2323

2424
# sha256-mwH/Oz1bMiZ9vHH84YJ6PbP6BpLW5nG9AD9Lad8u1+c= is an inline style for accesbility
25-
set $csp_header "script-src 'nonce-$request_id' 'self'; style-src 'self' 'sha256-mwH/Oz1bMiZ9vHH84YJ6PbP6BpLW5nG9AD9Lad8u1+c=' 'nonce-$request_id'; default-src 'self'; object-src 'none'; base-uri 'self'; connect-src 'self' https://sso.puzzle.ch; font-src 'self'; frame-src 'self' https://sso.puzzle.ch; img-src 'self'; manifest-src 'self'; media-src 'self'; worker-src 'none';";
25+
set $csp_header "script-src 'nonce-$request_id' 'self'; style-src 'self' 'sha256-mwH/Oz1bMiZ9vHH84YJ6PbP6BpLW5nG9AD9Lad8u1+c=' 'nonce-$request_id'; default-src 'self'; object-src 'none'; base-uri 'self'; connect-src 'self' https://sso.puzzle.ch http://localhost:8544; font-src 'self'; frame-src 'self' https://sso.puzzle.ch; img-src 'self'; manifest-src 'self'; media-src 'self'; worker-src 'none';";
2626

2727
add_header Content-Security-Policy $csp_header;
2828

frontend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,11 @@
3737
"@angular/material-luxon-adapter": "^21.0.3",
3838
"@angular/platform-browser": "^21.0.4",
3939
"@angular/router": "^21.0.4",
40-
"@eslint/js": "^10.0.0",
4140
"@ngx-translate/core": "^18.0.0",
4241
"@ngx-translate/http-loader": "^18.0.0",
4342
"@puzzleitc/puzzle-shell": "^5.1.0",
4443
"bootstrap": "^5.3.7",
45-
"cypress": "^15.2.0",
4644
"date-fns": "^4.1.0",
47-
"jest-environment-jsdom": "^30.2.0",
4845
"keycloak-angular": "^22.0.0",
4946
"keycloak-js": "^26.2.2",
5047
"luxon": "^3.7.2",
@@ -53,6 +50,9 @@
5350
"tslib": "^2.3.0"
5451
},
5552
"devDependencies": {
53+
"@eslint/js": "^10.0.0",
54+
"jest-environment-jsdom": "^30.2.0",
55+
"cypress": "^15.2.0",
5656
"@angular-eslint/eslint-plugin": "^22.0.0",
5757
"@angular-eslint/eslint-plugin-template": "^22.0.0",
5858
"@angular-eslint/schematics": "^22.0.0",

frontend/pnpm-lock.yaml

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)