Skip to content

Commit 4b94e31

Browse files
committed
Merge branch 'main' into fix-i18n
2 parents fa6440a + fded6e0 commit 4b94e31

File tree

18 files changed

+269
-21
lines changed

18 files changed

+269
-21
lines changed

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Use the latest LTS version of Node.js
2-
# https://hub.docker.com/_/node
3-
FROM node:22@sha256:37ff334612f77d8f999c10af8797727b731629c26f2e83caa6af390998bdc49c AS build-stage
1+
# BUILD STAGE
2+
FROM node:24-slim@sha256:36ae19f59c91f3303c7a648f07493fe14c4bd91320ac8d898416327bacf1bbfa AS build-stage
43
WORKDIR /usr/src/app
54

65
# Copy package.json and package-lock.json
@@ -14,11 +13,21 @@ ENV NODE_ENV=production
1413
COPY . .
1514
RUN npm run build
1615

17-
# The same image but now only install the production dependencies as the frontend is already built using vite in the build-stage
18-
FROM gcr.io/distroless/nodejs22-debian12@sha256:b765815eafacee5222bfa50179028f41dd8c642b68ad68ec4e6922d3b1ff2710 AS production
16+
# Remove dev dependencies so the node_modules directory that we COPY into the distroless image contains only runtime dependencies
17+
RUN npm prune --omit=dev
1918

19+
20+
# PRODUCTION STAGE
21+
FROM gcr.io/distroless/nodejs24-debian12@sha256:20a51c926c0bb68a9b1f7059c81516da002655f8a896a2cb7bc56b56974782b3 AS production
2022
WORKDIR /usr/src/app
2123

22-
COPY --from=build-stage /usr/src/app /usr/src/app
24+
# Copy built files
25+
COPY --from=build-stage /usr/src/app/dist/client /usr/src/app/dist/client
26+
COPY --from=build-stage /usr/src/app/dist/vite.config.json /usr/src/app/dist/vite.config.json
27+
COPY --from=build-stage /usr/src/app/dist/server /usr/src/app/server
28+
COPY --from=build-stage /usr/src/app/dist/server.js /usr/src/app/server.js
29+
COPY --from=build-stage /usr/src/app/public /usr/src/app/public
30+
COPY --from=build-stage /usr/src/app/node_modules /usr/src/app/node_modules
2331

32+
# Run
2433
CMD ["server.js"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ The UI will be served on http://localhost:5173.
4141
To enable local development with Safari, follow these steps on your local machine:
4242

4343
1. **Update Cookie Settings:**
44-
In [`server/encrypted-session.js`](server/encrypted-session.js), set the `secure` property to `false` in both occurrences.
44+
In [`server/encrypted-session.js`](server/encrypted-session.ts), set the `secure` property to `false` in both occurrences.
4545

4646
2. **Disable Helmet Registration:**
47-
In [`server.js`](server.js), comment out or remove the registration of `helmet`.
47+
In [`server.js`](server.ts), comment out or remove the registration of `helmet`.
4848

4949

5050
### Build & Production

package-lock.json

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

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"version": "0.0.0",
44
"type": "module",
55
"engines": {
6-
"node": "^22.0.0",
6+
"node": "^24.0.0",
77
"npm": "^11.0.0"
88
},
99
"scripts": {
10-
"dev": "node server.js --local-dev",
11-
"start": "node server.js",
12-
"build": "tsc && vite build",
10+
"dev": "node --loader ts-node/esm ./server.ts --local-dev",
11+
"start": "node dist/server/server.js",
12+
"build": "tsc && npm run build:server && vite build",
13+
"build:server": "tsc -p tsconfig.server.json",
1314
"lint": "eslint ./src --report-unused-disable-directives --max-warnings 0",
1415
"preview": "vite preview",
1516
"test:vi": "vitest",
@@ -81,8 +82,10 @@
8182
"eslint-plugin-prettier": "^5.2.3",
8283
"eslint-plugin-react": "^7.37.4",
8384
"eslint-plugin-react-hooks": "^5.2.0",
85+
"fastify-tsconfig": "^3.0.0",
8486
"globals": "^16.0.0",
8587
"prettier": "^3.5.3",
88+
"ts-node": "^10.9.2",
8689
"typescript": "^5.7.3",
8790
"typescript-eslint": "^8.26.1",
8891
"vite": "^6.3.4",

server.js renamed to server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if (!process.env.BFF_SENTRY_DSN || process.env.BFF_SENTRY_DSN.trim() === '') {
2020
beforeSend(event) {
2121
if (event.request && event.request.cookies) {
2222
event.request.cookies = Object.keys(event.request.cookies).reduce((acc, key) => {
23+
// @ts-ignore
2324
acc[key] = '';
2425
return acc;
2526
}, {});
@@ -49,8 +50,10 @@ Sentry.setupFastifyErrorHandler(fastify);
4950
await fastify.register(envPlugin);
5051

5152
let sentryHost = '';
53+
// @ts-ignore
5254
if (fastify.config.VITE_SENTRY_DSN && fastify.config.VITE_SENTRY_DSN.length > 0) {
5355
try {
56+
// @ts-ignore
5457
sentryHost = new URL(fastify.config.VITE_SENTRY_DSN).hostname;
5558
} catch {
5659
console.log('VITE_SENTRY_DSN is not a valid URL');
@@ -63,6 +66,7 @@ fastify.register(helmet, {
6366
directives: {
6467
'connect-src': ["'self'", 'sdk.openui5.org', sentryHost],
6568
'script-src': isLocalDev ? ["'self'", "'unsafe-inline'"] : ["'self'"],
69+
// @ts-ignore
6670
'frame-ancestors': [fastify.config.FRAME_ANCESTORS],
6771
},
6872
},
@@ -78,6 +82,7 @@ await fastify.register(FastifyVite, {
7882
spa: true,
7983
});
8084

85+
// @ts-ignore
8186
fastify.get('/', function (req, reply) {
8287
return reply.html();
8388
});
@@ -88,6 +93,7 @@ fastify.listen(
8893
port: 5173,
8994
host: '0.0.0.0',
9095
},
96+
// @ts-ignore
9197
function (err, address) {
9298
if (err) {
9399
fastify.log.error(err);

0 commit comments

Comments
 (0)