Skip to content

Commit

Permalink
Merge pull request #193 from navikt/feature/nais-docker-push
Browse files Browse the repository at this point in the history
Ta i bruk nais/docker-build-push
  • Loading branch information
akgagnat authored Aug 10, 2023
2 parents 2489128 + 4e24800 commit c5edb17
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 106 deletions.
82 changes: 0 additions & 82 deletions .github/workflows/auto-deployment.yml

This file was deleted.

29 changes: 17 additions & 12 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: Build and push Docker container
on:
workflow_call:
outputs:
image:
description: "The docker image"
value: ${{ jobs.build-and-push.outputs.image }}
inputs:
environment:
required: true
type: string

env:
IMAGE: ghcr.io/${{ github.repository }}/send-inn-frontend:${{ inputs.environment }}_${{ github.sha }}

jobs:
build-and-push:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -21,21 +25,22 @@ jobs:
cache: 'npm'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set environment variables
run: cp environments/${{ inputs.environment }}.env .env
- name: Build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: npm run build
- name: Publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
docker build --tag ${IMAGE} .
docker push ${IMAGE}
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: team-soknad
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: ${{ inputs.environment }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}



4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
env:
IMAGE: ghcr.io/${{ github.repository }}/send-inn-frontend:prod_${{ github.sha }}

jobs:
build-and-test:
Expand All @@ -34,4 +32,4 @@ jobs:
PRINT_PAYLOAD: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VAR: app_version=${{ github.sha }}
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
9 changes: 3 additions & 6 deletions .github/workflows/manual-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
- preprod-alt
- prod

env:
IMAGE: ghcr.io/${{ github.repository }}/send-inn-frontend:${{ github.event.inputs.environment }}_${{ github.sha }}

jobs:
build-and-test:
name: Test frontend
Expand All @@ -42,7 +39,7 @@ jobs:
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod.yml
VAR: app_version=${{ github.sha }}
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-preprod-alt:
name: Deploy to preprod-alt
Expand All @@ -58,7 +55,7 @@ jobs:
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod-alt.yml
VAR: app_version=${{ github.sha }}
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-prod:
name: Deploy to prod
Expand All @@ -74,5 +71,5 @@ jobs:
PRINT_PAYLOAD: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VAR: app_version=${{ github.sha }}
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

4 changes: 1 addition & 3 deletions .github/workflows/preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
env:
IMAGE: ghcr.io/${{ github.repository }}/send-inn-frontend:preprod_${{ github.sha }}

jobs:
build-and-test:
Expand All @@ -34,6 +32,6 @@ jobs:
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod.yml
VAR: app_version=${{ github.sha }}
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}


0 comments on commit c5edb17

Please sign in to comment.