Skip to content

Commit ca7a1f1

Browse files
authored
Merge pull request #57 from navikt/hotbff
Hotbff
2 parents 2a9242d + 90a3b6b commit ca7a1f1

33 files changed

+147
-7981
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'CODEOWNERS'
99
branches:
1010
- main
11+
- hotbff
1112

1213
jobs:
1314
build:

.nais/dev.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ spec:
1212
ingresses:
1313
- https://brilleavtale.intern.dev.nav.no/hjelpemidler/brilleavtale
1414
liveness:
15-
path: /hjelpemidler/brilleavtale/internal/isalive
15+
path: /isalive
1616
readiness:
17-
path: /hjelpemidler/brilleavtale/internal/isready
17+
path: /isready
1818
prometheus:
19-
enabled: true
20-
path: /hjelpemidler/brilleavtale/internal/metrics
19+
enabled: false
20+
path: /metrics
2121
replicas:
2222
max: 1
2323
min: 1
@@ -42,11 +42,11 @@ spec:
4242
value: 'http://hm-brille-api.teamdigihot.svc.cluster.local'
4343
- name: BRILLE_API_TARGET_AUDIENCE
4444
value: dev-gcp:teamdigihot:hm-brille-api
45-
- name: PORT
46-
value: '5000'
4745
- name: GIT_COMMIT
4846
value: {{commit}}
4947
accessPolicy:
5048
outbound:
5149
rules:
5250
- application: hm-brille-api
51+
- application: nav-dekoratoren
52+
namespace: personbruker

.nais/labs.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ spec:
1212
ingresses:
1313
- https://brilleavtale-labs.ekstern.dev.nav.no/hjelpemidler/brilleavtale
1414
liveness:
15-
path: /hjelpemidler/brilleavtale/internal/isalive
15+
path: /isalive
1616
readiness:
17-
path: /hjelpemidler/brilleavtale/internal/isready
17+
path: /isready
1818
prometheus:
19-
enabled: true
20-
path: /hjelpemidler/brilleavtale/internal/metrics
19+
enabled: false
20+
path: /metrics
2121
replicas:
2222
max: 1
2323
min: 1
@@ -29,14 +29,10 @@ spec:
2929
cpu: 20m
3030
memory: 256Mi
3131
env:
32-
- name: IS_LABS
33-
value: 'true'
3432
- name: BRILLE_API_BASE_URL
3533
value: ''
3634
- name: BRILLE_API_TARGET_AUDIENCE
3735
value: ''
38-
- name: PORT
39-
value: '5000'
4036
- name: USE_MSW
4137
value: 'true'
4238
- name: GIT_COMMIT

.nais/prod.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ spec:
1212
ingresses:
1313
- https://www.nav.no/hjelpemidler/brilleavtale
1414
liveness:
15-
path: /hjelpemidler/brilleavtale/internal/isalive
15+
path: /isalive
1616
readiness:
17-
path: /hjelpemidler/brilleavtale/internal/isready
17+
path: /isready
1818
prometheus:
19-
enabled: true
20-
path: /hjelpemidler/brilleavtale/internal/metrics
19+
enabled: false
20+
path: /metrics
2121
replicas:
2222
max: 2
2323
min: 2
@@ -42,13 +42,13 @@ spec:
4242
value: 'http://hm-brille-api.teamdigihot.svc.cluster.local'
4343
- name: BRILLE_API_TARGET_AUDIENCE
4444
value: prod-gcp:teamdigihot:hm-brille-api
45-
- name: PORT
46-
value: '5000'
4745
- name: GIT_COMMIT
4846
value: {{commit}}
4947
accessPolicy:
5048
outbound:
5149
rules:
5250
- application: hm-brille-api
51+
- application: nav-dekoratoren
52+
namespace: personbruker
5353
external:
5454
- host: www.nav.no

Dockerfile

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,30 @@
1-
FROM node:20.14.0-alpine as node
1+
FROM node:lts-alpine AS node
22
RUN --mount=type=secret,id=NODE_AUTH_TOKEN \
33
npm config set //npm.pkg.github.com/:_authToken=$(cat /run/secrets/NODE_AUTH_TOKEN)
44
RUN npm config set @navikt:registry=https://npm.pkg.github.com
55

66
# build client
7-
FROM node as client-builder
7+
FROM node AS client-builder
88
WORKDIR /app
99
COPY client/package.json client/package-lock.json ./
1010
RUN npm ci
1111
COPY client .
1212
RUN npm run build
1313

1414
# build server
15-
FROM node as server-builder
15+
FROM golang:1.25.1-alpine AS server-builder
1616
WORKDIR /app
17-
COPY server/package.json server/package-lock.json ./
18-
RUN npm ci
19-
COPY server .
20-
RUN npm run build
21-
22-
# install server dependencies
23-
FROM node as server-dependencies
24-
WORKDIR /app
25-
COPY server/package.json server/package-lock.json ./
26-
RUN npm ci --omit dev
17+
COPY server ./
18+
RUN go build .
2719

2820
# runtime
29-
FROM gcr.io/distroless/nodejs20-debian12 as runtime
21+
FROM gcr.io/distroless/static-debian12 AS runtime
3022
WORKDIR /app
3123

32-
ARG NODE_ENV=production
33-
ENV NODE_ENV=${NODE_ENV}
3424
ENV TZ="Europe/Oslo"
35-
EXPOSE 3000
36-
37-
COPY --from=client-builder /app/dist ./client/dist
38-
COPY --from=server-builder /app/dist ./server/dist
39-
40-
WORKDIR /app/server
25+
EXPOSE 5000
4126

42-
COPY --from=server-dependencies /app/node_modules ./node_modules
27+
COPY --from=client-builder /app/dist ./dist
28+
COPY --from=server-builder /app/hm-brilleavtale-frontend .
4329

44-
CMD [ "--enable-source-maps", "-r", "dotenv/config", "dist/server.mjs" ]
30+
CMD [ "./hm-brilleavtale-frontend" ]

client/index.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="no">
3+
34
<head>
45
<meta charset="utf-8" />
56
<link rel="icon" href="/favicon.ico" />
67
<meta name="viewport" content="width=device-width, initial-scale=1" />
7-
{{{DECORATOR_STYLES}}}
8+
{{.HeadAssets}}
89
<title>NAV Brilleavtale</title>
910
</head>
11+
1012
<body>
11-
<noscript>You need to enable JavaScript to run this app.</noscript>
12-
{{{DECORATOR_HEADER}}}
13-
<div id="root"></div>
14-
{{{DECORATOR_FOOTER}}}
15-
{{{DECORATOR_SCRIPTS}}}
16-
<script type="module" src="/src/main.tsx"></script>
13+
<noscript>You need to enable JavaScript to run this app.</noscript>
14+
{{.Header}}
15+
<div id="root"></div>
16+
{{.Footer}}
17+
{{.Scripts}}
18+
<script type="module" src="/src/main.tsx"></script>
1719
</body>
18-
</html>
20+
21+
</html>

client/src/global.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interface Window {
22
appSettings: {
33
GIT_COMMIT?: string
4-
MILJO?: 'labs-gcp' | 'dev-gcp' | 'prod-gcp'
4+
NAIS_CLUSTER_NAME?: 'labs-gcp' | 'dev-gcp' | 'prod-gcp'
55
USE_MSW?: boolean
66
}
77
}

client/vite.config.mts

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,41 @@ const htmlPlugin = ({ development }: { development?: boolean }): Plugin => ({
99
if (development) {
1010
const decorator = await fetchDecoratorHtml({
1111
env: 'dev',
12-
context: 'samarbeidspartner',
13-
chatbot: false,
14-
language: 'nb',
15-
availableLanguages: [
16-
{
17-
locale: 'nb',
18-
handleInApp: true,
19-
},
20-
{
21-
locale: 'nn',
22-
handleInApp: true,
23-
},
24-
],
12+
params: {
13+
context: 'samarbeidspartner',
14+
chatbot: false,
15+
language: 'nb',
16+
availableLanguages: [
17+
{
18+
locale: 'nb',
19+
handleInApp: true,
20+
},
21+
{
22+
locale: 'nn',
23+
handleInApp: true,
24+
},
25+
],
26+
},
2527
})
28+
const {
29+
DECORATOR_HEAD_ASSETS: HeadAssets,
30+
DECORATOR_HEADER: Header,
31+
DECORATOR_FOOTER: Footer,
32+
DECORATOR_SCRIPTS: Scripts,
33+
} = decorator
2634
return {
27-
html: Mustache.render(html, decorator),
35+
html: Mustache.render(html.replace(/\{\{\./g, '{{{').replace(/\}\}/g, '}}}'), {
36+
HeadAssets,
37+
Header,
38+
Footer,
39+
Scripts,
40+
}),
2841
tags: [
2942
{
3043
tag: 'script',
3144
children: `window.appSettings = {
3245
GIT_COMMIT: 'ukjent',
33-
MILJO: 'labs-gcp',
46+
NAIS_CLUSTER_NAME: 'labs-gcp',
3447
USE_MSW: true,
3548
}`,
3649
},

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
version: "3"
21
services:
32
hm-brilleavtale-frontend:
43
build: .
54
image: "hm-brilleavtale-frontend"
65
ports:
7-
- "5000:5000"
6+
- "9000:5000"
7+
environment:
8+
NAIS_CLUSTER_NAME: 'dev-gcp'
9+
BIND_ADDRESS: ':5000'
10+
BRILLE_API_BASE_URL: 'http://localhost:4040'
11+
USE_MSW: 'true'

server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hm-brilleavtale-frontend

0 commit comments

Comments
 (0)