Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Felles dockerfile, allt over på distroless #1223

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/.deploy-app-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ jobs:
- name: Build application
run: yarn build-${{ inputs.app-name }}

- name: Build with turbo
run: yarn turbo run build-app --filter=@navikt/${{ inputs.app-name }}

- name: Build and publish docker image
uses: nais/docker-build-push@v0
id: docker-push
with:
team: dusseldorf
push_image: true
pull: true
dockerfile: apps/${{inputs.app-name}}/Dockerfile
dockerfile: Dockerfile
docker_context: .
build_args: APP_NAME=${{ inputs.app-name }}
image_suffix: ${{inputs.app-name}}-mono
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/.deploy-app-to-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
required: true

jobs:
deploy-to-prod:
name: Deploy ${{ inputs.app-name }} to prod
build:
name: Build ${{ inputs.app-name }}
runs-on: ubuntu-latest
permissions:
id-token: write # required: nais/docker-build-push
Expand All @@ -29,36 +29,44 @@ jobs:
cache: 'yarn'

- name: Install dependencies (yarn)
run: yarn
run: yarn install --production

- name: Build application
run: yarn build-${{ inputs.app-name }}

- name: Build with turbo
run: yarn turbo run build-app --filter=@navikt/${{ inputs.app-name }}

- name: Build and publish docker image
uses: nais/docker-build-push@v0
id: docker-push
with:
team: dusseldorf
push_image: true
pull: true
dockerfile: apps/${{inputs.app-name}}/Dockerfile
dockerfile: Dockerfile
docker_context: .
build_args: APP_NAME=${{ inputs.app-name }}
image_suffix: ${{inputs.app-name}}-mono
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}

- name: Deploy to prod
uses: nais/deploy/actions/deploy@v1
deploy:
name: Deploy ${{ inputs.app-name }} to prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
CLUSTER: prod-gcp
RESOURCE: nais-config/nais.yml
VARS: apps/${{ inputs.app-name }}/nais/prod-gcp.json
VAR: GITHUB_REF_NAME=${{ github.ref_name }} # brukes i applikasjonerna
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
IMAGE: ${{ steps.docker-push.outputs.image }}
IMAGE: ${{ needs.build.outputs.image }}

trivy:
needs: [ deploy-to-prod ]
needs: [ build ]
uses: navikt/sif-gha-workflows/.github/workflows/trivy.yml@main
permissions:
contents: write
Expand All @@ -67,5 +75,5 @@ jobs:
actions: read
secrets: inherit
with:
image: ${{ needs.deploy-to-prod.outputs.image }}
image: ${{ needs.build.outputs.image }}
team: dusseldorf
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM gcr.io/distroless/nodejs18-debian11
ARG APP_NAME

LABEL org.opencontainers.image.title=${APP_NAME}

WORKDIR /app

# Required by server.cjs
COPY /node_modules/ /node_modules/

# Local files
COPY /apps/${APP_NAME}/server.cjs .
COPY /apps/${APP_NAME}/tokenx.cjs .
COPY /apps/${APP_NAME}/package.json .
COPY /apps/${APP_NAME}/src/build/decorator.cjs ./src/build/decorator.cjs
COPY /apps/${APP_NAME}/dist ./dist

EXPOSE 8080
CMD ["server.cjs"]
28 changes: 0 additions & 28 deletions apps/ekstra-omsorgsdager-andre-forelder-ikke-tilsyn/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/endringsmelding-pleiepenger/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/omsorgsdager-aleneomsorg-dialog/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/omsorgspengerutbetaling-soknad/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/omsorgspengesoknad/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/pleiepenger-i-livets-sluttfase-soknad/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/pleiepenger-sykt-barn/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions apps/sif-ettersending/Dockerfile

This file was deleted.