Skip to content

Commit ff9a912

Browse files
committed
chore: cleanup Dockerfile Refs: KK-1539
1 parent b90ccab commit ff9a912

6 files changed

Lines changed: 37 additions & 59 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,34 @@
1111

1212
## [4.2.7](https://github.com/City-of-Helsinki/kukkuu-admin/compare/kukkuu-admin-v4.2.6...kukkuu-admin-v4.2.7) (2026-06-04)
1313

14-
1514
### Dependencies
1615

17-
* Bump axios from 1.15.2 to 1.16.0 ([79204b7](https://github.com/City-of-Helsinki/kukkuu-admin/commit/79204b728675752f05c470acc9b4e845b46c9dce))
18-
* Bump vitest from 3.2.4 to 4.1.0 ([885459e](https://github.com/City-of-Helsinki/kukkuu-admin/commit/885459ed1b46f84775f37f86101298d481a01860))
19-
* Vite 8 migration required for vitest ([43d1d0d](https://github.com/City-of-Helsinki/kukkuu-admin/commit/43d1d0d660b05727ed36049561db8176cb06f9b7))
16+
- Bump axios from 1.15.2 to 1.16.0 ([79204b7](https://github.com/City-of-Helsinki/kukkuu-admin/commit/79204b728675752f05c470acc9b4e845b46c9dce))
17+
- Bump vitest from 3.2.4 to 4.1.0 ([885459e](https://github.com/City-of-Helsinki/kukkuu-admin/commit/885459ed1b46f84775f37f86101298d481a01860))
18+
- Vite 8 migration required for vitest ([43d1d0d](https://github.com/City-of-Helsinki/kukkuu-admin/commit/43d1d0d660b05727ed36049561db8176cb06f9b7))
2019

2120
## [4.2.6](https://github.com/City-of-Helsinki/kukkuu-admin/compare/kukkuu-admin-v4.2.5...kukkuu-admin-v4.2.6) (2026-05-11)
2221

23-
2422
### Dependencies
2523

26-
* Bump @babel/plugin-transform-modules-systemjs ([1e3f286](https://github.com/City-of-Helsinki/kukkuu-admin/commit/1e3f2866726349dd5706f76a25f3afff635247a9))
27-
* Bump axios from 1.15.0 to 1.15.2 ([adf5e91](https://github.com/City-of-Helsinki/kukkuu-admin/commit/adf5e914a006614951c741d6937ee3830db24b6b))
28-
* Bump fast-uri from 3.1.0 to 3.1.2 ([96c7236](https://github.com/City-of-Helsinki/kukkuu-admin/commit/96c7236ba1f0f2e1d63e540b85fa77fe923079e2))
29-
* Bump postcss from 8.5.9 to 8.5.14 ([8a7a355](https://github.com/City-of-Helsinki/kukkuu-admin/commit/8a7a3555f8159ca2ceb2461d64f1483802077d4e))
24+
- Bump @babel/plugin-transform-modules-systemjs ([1e3f286](https://github.com/City-of-Helsinki/kukkuu-admin/commit/1e3f2866726349dd5706f76a25f3afff635247a9))
25+
- Bump axios from 1.15.0 to 1.15.2 ([adf5e91](https://github.com/City-of-Helsinki/kukkuu-admin/commit/adf5e914a006614951c741d6937ee3830db24b6b))
26+
- Bump fast-uri from 3.1.0 to 3.1.2 ([96c7236](https://github.com/City-of-Helsinki/kukkuu-admin/commit/96c7236ba1f0f2e1d63e540b85fa77fe923079e2))
27+
- Bump postcss from 8.5.9 to 8.5.14 ([8a7a355](https://github.com/City-of-Helsinki/kukkuu-admin/commit/8a7a3555f8159ca2ceb2461d64f1483802077d4e))
3028

3129
## [4.2.5](https://github.com/City-of-Helsinki/kukkuu-admin/compare/kukkuu-admin-v4.2.4...kukkuu-admin-v4.2.5) (2026-04-23)
3230

33-
3431
### Dependencies
3532

36-
* Bump follow-redirects from 1.15.11 to 1.16.0 ([ec53e69](https://github.com/City-of-Helsinki/kukkuu-admin/commit/ec53e69e268ed40fe76059641b43ba3bdea74153))
33+
- Bump follow-redirects from 1.15.11 to 1.16.0 ([ec53e69](https://github.com/City-of-Helsinki/kukkuu-admin/commit/ec53e69e268ed40fe76059641b43ba3bdea74153))
3734

3835
## [4.2.4](https://github.com/City-of-Helsinki/kukkuu-admin/compare/kukkuu-admin-v4.2.3...kukkuu-admin-v4.2.4) (2026-04-15)
3936

40-
4137
### Dependencies
4238

43-
* Bump axios from 1.13.5 to 1.15.0 ([3f128bb](https://github.com/City-of-Helsinki/kukkuu-admin/commit/3f128bb4b2d136255218916aff6295f733f8cf19))
44-
* Bump vite from 6.4.1 to 6.4.2 ([4e9d83f](https://github.com/City-of-Helsinki/kukkuu-admin/commit/4e9d83fdd587b4f121ade218a52676a0f8e9ce49))
45-
* Update vulnerable packages ([c188e40](https://github.com/City-of-Helsinki/kukkuu-admin/commit/c188e40850420117949d6a54d41dd23a65dca56a))
39+
- Bump axios from 1.13.5 to 1.15.0 ([3f128bb](https://github.com/City-of-Helsinki/kukkuu-admin/commit/3f128bb4b2d136255218916aff6295f733f8cf19))
40+
- Bump vite from 6.4.1 to 6.4.2 ([4e9d83f](https://github.com/City-of-Helsinki/kukkuu-admin/commit/4e9d83fdd587b4f121ade218a52676a0f8e9ce49))
41+
- Update vulnerable packages ([c188e40](https://github.com/City-of-Helsinki/kukkuu-admin/commit/c188e40850420117949d6a54d41dd23a65dca56a))
4642

4743
## [4.2.3](https://github.com/City-of-Helsinki/kukkuu-admin/compare/kukkuu-admin-v4.2.2...kukkuu-admin-v4.2.3) (2026-03-23)
4844

Dockerfile

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,11 @@
22
# STAGE 1: Build base (install dependencies)
33
# ============================================================
44
FROM helsinki.azurecr.io/ubi9/nodejs-24-pnpm-builder-base AS appbase
5-
WORKDIR /app
6-
7-
# Defaults to production; compose overrides this to development on build and run.
8-
ARG NODE_ENV=production
9-
ENV NODE_ENV=$NODE_ENV
105

11-
# 1. Install dependencies (cached unless the manifests change).
12-
# corepack in the base image uses the pnpm version from package.json's
13-
# "packageManager" field automatically.
6+
# 1. Copy only necessary files for build
147
COPY --chown=default:root package.json pnpm-lock.yaml pnpm-workspace.yaml ./
15-
RUN pnpm install --frozen-lockfile --ignore-scripts && pnpm store prune
16-
17-
# 2. Generate a build-time public/env-config.js. Its *contents* are overwritten
18-
# at container start by the base image's env.sh with the real runtime values.
19-
# update-runtime-env only needs the script, the public/ output dir and the .env
20-
# key templates, so copy just those — editing src/ won't invalidate this layer.
21-
COPY --chown=default:root scripts ./scripts
228
COPY --chown=default:root public ./public
23-
COPY --chown=default:root .env* ./
24-
RUN pnpm update-runtime-env
25-
26-
# 3. Copy only the sources the production build (`tsc && vite build`) consumes.
27-
# tsconfig "include" is ["src"]; the build also reads these root configs — Vite
28-
# itself, the babel presets used by @vitejs/plugin-react, and the eslint/prettier
29-
# configs run by @nabla/vite-plugin-eslint. Tests, docs, codegen and other
30-
# tooling are intentionally left out (and also pruned via .dockerignore).
9+
COPY --chown=default:root scripts ./scripts
3110
COPY --chown=default:root \
3211
index.html \
3312
vite.config.ts \
@@ -38,15 +17,24 @@ COPY --chown=default:root \
3817
.eslintignore \
3918
.prettierrc.json \
4019
.prettierignore \
20+
.env* \
4121
./
42-
COPY --chown=default:root src ./src
22+
COPY --chown=default:root ./src ./src
23+
24+
# 2. Run the install and update-runtime-env script
25+
# corepack in the base image will automatically use the version of pnpm
26+
# defined in your package.json 'packageManager' field if present.
27+
RUN pnpm install --frozen-lockfile --ignore-scripts && pnpm store prune
28+
RUN pnpm update-runtime-env
4329

4430
# ============================================================
4531
# STAGE 2: Development
4632
# ============================================================
4733
FROM appbase AS development
34+
4835
WORKDIR /app
4936

37+
# Set NODE_ENV to development in the development container
5038
ARG NODE_ENV=development
5139
ENV NODE_ENV=$NODE_ENV
5240

@@ -57,6 +45,8 @@ ENV NODE_ENV=$NODE_ENV
5745
ARG CHOKIDAR_USEPOLLING=true
5846
ENV CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING}
5947

48+
EXPOSE 8080
49+
6050
# `pnpm start` runs update-runtime-env then vite (port from PORT env, default 3001).
6151
CMD ["pnpm", "start", "--no-open", "--host"]
6252

@@ -73,14 +63,6 @@ ENV VITE_CSP_REPORT_URI=${VITE_CSP_REPORT_URI:-""}
7363

7464
RUN pnpm build
7565

76-
# Produce a sanitized runtime env template for the production image. The base
77-
# image's env.sh is a naive KEY=VALUE parser: it does NOT skip comments or blank
78-
# lines, so any "# comment"/blank line in .env makes it emit an empty-key entry
79-
# (`: ""`) or duplicate the previous key — corrupting env-config.js into invalid
80-
# JavaScript (SyntaxError at load → window._env_ undefined → app can't boot).
81-
# Keep only `KEY=VALUE` lines so env.sh always generates valid JS.
82-
RUN grep -E '^[A-Za-z_][A-Za-z0-9_]*=' .env.example > .env.runtime
83-
8466
# ============================================================
8567
# STAGE 4: Production runtime
8668
# ============================================================
@@ -89,19 +71,15 @@ FROM helsinki.azurecr.io/ubi10/nginx-126-spa-standard AS production
8971
# 1. Copy the compiled assets.
9072
COPY --from=staticbuilder /app/build /usr/share/nginx/html
9173

92-
# 2. Runtime env injection inputs (env.sh from the base image reads these).
93-
# .env lists which keys to expose in env-config.js; the values are overwritten
94-
# at container start with the real runtime environment. Use the sanitized,
95-
# comment-free template (see staticbuilder) — the base image's env.sh cannot
96-
# parse comments/blank lines and would otherwise emit invalid JavaScript.
74+
# 2. Setup Runtime Env Injection
75+
# env.sh is provided by the base image
9776
WORKDIR /usr/share/nginx/html
98-
COPY --from=staticbuilder /app/.env.runtime ./.env
77+
COPY .env .
9978

100-
# 3. package.json powers the base image's /readiness version endpoint.
79+
# 3. Inject Versioning for the /readiness endpoint from package.json using base image
10180
COPY package.json .
10281

103-
# Inherited from the base image:
104-
# - env.sh at /usr/share/nginx/html/env.sh
105-
# - USER 1001
106-
# - EXPOSE 8080
107-
# - ENTRYPOINT/CMD
82+
# - env.sh (Inherited from base image at /usr/share/nginx/html/env.sh)
83+
# - USER 1001 (Inherited from base image)
84+
# - EXPOSE 8080 (Inherited from base image)
85+
# - ENTRYPOINT/CMD (Inherited from base image)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
99
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
10+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1011

1112
- [Service architecture](#service-architecture)
1213
- [Environments](#environments)

docs/setup-keycloak.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34

45
- [Using the Helsinki-Profile Keycloak](#using-the-helsinki-profile-keycloak)
56

docs/setup-local-kukkuu-api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34

45
- [Use Kukkuu API locally](#use-kukkuu-api-locally)
56

docs/setup-tunnistamo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34

45
- [Setting up Tunnistamo and Kukkuu API locally with Docker](#setting-up-tunnistamo-and-kukkuu-api-locally-with-docker)
56
- [Set Tunnistamo hostname](#set-tunnistamo-hostname)

0 commit comments

Comments
 (0)