Skip to content

Commit 0b78de8

Browse files
committed
fix: streamline Dockerfile and server startup script
1 parent 768d96b commit 0b78de8

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ FROM gcr.io/distroless/nodejs24-debian12@sha256:98fd27d54e32d0d281a4c41db1bbe87a
2222
WORKDIR /usr/src/app
2323

2424
# 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
25+
COPY --from=build-stage /usr/src/app/dist /usr/src/app/dist
3026
COPY --from=build-stage /usr/src/app/node_modules /usr/src/app/node_modules
3127

3228
# Run
33-
CMD ["server.js"]
29+
CMD ["dist/server.js"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"scripts": {
1010
"dev": "node --loader ts-node/esm ./server.ts --local-dev",
11-
"start": "node dist/server/server.js",
11+
"start": "node dist/server.js",
1212
"build": "tsc && npm run build:server && vite build",
1313
"build:server": "tsc -p tsconfig.server.json",
1414
"lint": "eslint ./src --report-unused-disable-directives --max-warnings 0",

server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { injectDynatraceTag } from './server/config/dynatrace.js';
1212

1313
dotenv.config();
1414

15+
console.log(process.env);
16+
1517
const { DYNATRACE_SCRIPT_URL } = process.env;
1618
if (DYNATRACE_SCRIPT_URL) {
1719
injectDynatraceTag(DYNATRACE_SCRIPT_URL);
@@ -50,7 +52,11 @@ if (process.env.FRONTEND_CONFIG_PATH !== undefined && process.env.FRONTEND_CONFI
5052
}
5153

5254
// Make hyperspace portal configuration available (hyperspace-portal-config.json)
53-
if (!isLocalDev && process.env.HYPERSPACE_PORTAL_CONFIG_PATH !== undefined && process.env.HYPERSPACE_PORTAL_CONFIG_PATH.length > 0) {
55+
if (
56+
!isLocalDev &&
57+
process.env.HYPERSPACE_PORTAL_CONFIG_PATH !== undefined &&
58+
process.env.HYPERSPACE_PORTAL_CONFIG_PATH.length > 0
59+
) {
5460
const hyperspacePortalConfigLocation = 'dist/client/hyperspace-portal-config.json';
5561
console.log('HYPERSPACE_PORTAL_CONFIG_PATH is specified. Will copy the hyperspace-portal-config from there.');
5662
console.log(` Copying ${process.env.HYPERSPACE_PORTAL_CONFIG_PATH} to ${hyperspacePortalConfigLocation}`);
@@ -85,7 +91,6 @@ if (DYNATRACE_SCRIPT_URL) {
8591
}
8692
}
8793

88-
8994
fastify.register(helmet, {
9095
contentSecurityPolicy: {
9196
directives: {

0 commit comments

Comments
 (0)