-
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
6 changed files
with
115 additions
and
63 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,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,45 +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) | ||
FROM node:20-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:20-alpine AS builder | ||
FROM gcr.io/distroless/nodejs20-debian11 AS runtime | ||
|
||
ARG DIGISOS_ENV | ||
|
||
ENV NEXT_PUBLIC_DIGISOS_ENV=${DIGISOS_ENV} | ||
WORKDIR /app | ||
COPY --from=dependencies /app/node_modules/ node_modules/ | ||
COPY . . | ||
|
||
RUN npm run orval | ||
RUN npm run build | ||
RUN npm prune --production | ||
WORKDIR /app | ||
|
||
COPY package.json /app/ | ||
COPY next-logger.config.js /app/ | ||
COPY .next/standalone /app/ | ||
COPY public /app/public/ | ||
|
||
FROM node:20-slim AS release | ||
EXPOSE 8080 | ||
|
||
ARG DIGISOS_ENV | ||
|
||
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 ["npm", "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