-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Konverterer til standalone og med cdn
- Loading branch information
Showing
7 changed files
with
152 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
name: "Build dev-sbs Image" | ||
on: | ||
workflow_dispatch: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-image: | ||
name: "Build dev-sbs Image" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
NEXT_PUBLIC_DIGISOS_ENV: dev-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: "Build Docker Image" | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.NEXT_PUBLIC_DIGISOS_ENV }} | ||
build-image: | ||
name: "Build dev-sbs Image" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
NEXT_PUBLIC_DIGISOS_ENV: dev-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: 'Build npm project' | ||
uses: navikt/sosialhjelp-ci/actions/build-npm@main | ||
with: | ||
node-version: 20 | ||
build-less: 'false' | ||
reader-token: ${{ secrets.READER_TOKEN }} | ||
run-test: 'false' | ||
run-orval: 'true' | ||
|
||
- name: 'Upload static files to cdn' | ||
id: upload | ||
uses: nais/deploy/actions/cdn-upload/v2@master | ||
with: | ||
team: teamdigisos | ||
source: ./build/static | ||
destination: "/sosialhjelp-soknad/_next" | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
|
||
- name: "Build Docker Image" | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.NEXT_PUBLIC_DIGISOS_ENV }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,45 @@ | ||
name: Build prod-sbs image - HUSK MANUELL DEPLOY TIL PROD! | ||
on: | ||
workflow_run: | ||
workflows: ["Build code and run test"] | ||
branches: | ||
- master | ||
- 'pre-next' | ||
types: | ||
- completed | ||
workflow_run: | ||
workflows: [ "Build code and run test" ] | ||
branches: | ||
- master | ||
- 'pre-next' | ||
types: | ||
- completed | ||
|
||
jobs: | ||
build-image: | ||
name: "Build prod-sbs Image" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
NEXT_PUBLIC_DIGISOS_ENV: prod-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: "Build Docker Image" | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.NEXT_PUBLIC_DIGISOS_ENV }} | ||
build-image: | ||
name: "Build prod-sbs Image" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
actions: write | ||
env: | ||
NEXT_PUBLIC_DIGISOS_ENV: prod-sbs | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }} | ||
READER_TOKEN: ${{ secrets.READER_TOKEN }} | ||
WORKFLOW_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: 'Build npm project' | ||
uses: navikt/sosialhjelp-ci/actions/build-npm@main | ||
with: | ||
node-version: 20 | ||
build-less: 'false' | ||
reader-token: ${{ secrets.READER_TOKEN }} | ||
run-test: 'false' | ||
run-orval: 'true' | ||
- name: 'Upload static files to cdn' | ||
id: upload | ||
uses: nais/deploy/actions/cdn-upload/v2@master | ||
with: | ||
team: teamdigisos | ||
source: ./build/static | ||
destination: "/sosialhjelp-soknad/_next" | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
- name: "Build Docker Image" | ||
uses: navikt/sosialhjelp-soknad/.github/actions/build-image@master | ||
with: | ||
prefix: ${{ env.NEXT_PUBLIC_DIGISOS_ENV }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,21 @@ | ||
# NB: Når Node-versjon endres, bør samme endring også gjøres i: | ||
# - .nvmrc | ||
# - .github/dependabot.yml (fjern versjonspin for docker) | ||
# - packages.json under "engines" (her leter dependabot npm) | ||
# - .ncurc.js (automatiske oppdateringer for node-types) | ||
# pt er vi på node 18 fordi ellers plager dekoratoren oss med "body has already been consumed" | ||
FROM node:18-alpine AS dependencies | ||
|
||
WORKDIR /app | ||
COPY package.json . | ||
COPY package-lock.json . | ||
COPY .npmrc.dockerbuild .npmrc | ||
|
||
RUN --mount=type=secret,id=NODE_AUTH_TOKEN NODE_AUTH_TOKEN=$(cat /run/secrets/NODE_AUTH_TOKEN) \ | ||
npm ci --prefer-offline --no-audit | ||
|
||
FROM node:18-alpine AS builder | ||
FROM gcr.io/distroless/nodejs20-debian11 AS runtime | ||
|
||
ARG DIGISOS_ENV | ||
ARG LOGIN_SESSION_API_URL | ||
ARG LOGOUT_URL | ||
|
||
ENV NEXT_PUBLIC_DIGISOS_ENV=${DIGISOS_ENV} | ||
ENV LOGIN_SESSION_API_URL=${LOGIN_SESSION_API_URL} | ||
ENV LOGOUT_URL=${LOGOUT_URL} | ||
|
||
WORKDIR /app | ||
COPY --from=dependencies /app/node_modules/ node_modules/ | ||
COPY . . | ||
|
||
RUN npm run orval | ||
RUN npm run build | ||
RUN npm prune --production | ||
|
||
|
||
FROM gcr.io/distroless/nodejs18-debian12 AS runner | ||
COPY package.json /app/ | ||
COPY next-logger.config.js /app/ | ||
COPY build/standalone /app/ | ||
COPY public /app/public/ | ||
|
||
ARG DIGISOS_ENV | ||
EXPOSE 8080 | ||
|
||
ENV NEXT_PUBLIC_DIGISOS_ENV=${DIGISOS_ENV} | ||
ENV NODE_ENV=production | ||
ENV PORT=8080 | ||
ENV HOSTNAME=0.0.0.0 | ||
ENV NODE_ENV=production | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder --chown=1069:1069 /app/build build | ||
COPY --from=builder /app/node_modules/ node_modules/ | ||
COPY package.json . | ||
COPY . . | ||
#ENV NODE_OPTIONS '-r next-logger' | ||
|
||
CMD ["./node_modules/next/dist/bin/next", "start"] | ||
CMD ["server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters