Repository navigation
Merge pull request #170 from navikt/sakslogg #676
This file contains hidden or 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
| name: CICD Backend | |
| on: | |
| push: | |
| paths: | |
| - backend/** | |
| - nais/dev-gcp-backend.yaml | |
| - nais/prod-gcp-backend.yaml | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 6 * * 1' # bygg nytt image hver mandag morgen | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| services: | |
| postgres: | |
| image: postgres:18.0 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5532:5432 | |
| gotenberg: | |
| image: gotenberg/gotenberg:8.37.0 | |
| env: | |
| CHROMIUM_DISABLE_JAVASCRIPT: "true" | |
| CHROMIUM_ALLOW_LIST: "^file:///tmp/.*" | |
| API_DISABLE_DOWNLOAD_FROM: "true" | |
| WEBHOOK_DISABLE: "true" | |
| LIBREOFFICE_DISABLE_ROUTES: "true" | |
| CHROMIUM_MAX_CONCURRENCY: "2" | |
| options: >- | |
| --health-cmd "curl -fsS http://localhost:3000/health || exit 1" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| ports: | |
| - 3003:3000 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: PGPASSWORD=postgres psql -U postgres -h localhost -p 5532 -f ./backend/local-db-init.sql | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21 | |
| cache: maven | |
| cache-dependency-path: backend/pom.xml | |
| - run: mvn -B package | |
| working-directory: backend | |
| - uses: nais/docker-build-push@v0 | |
| id: docker-build-push | |
| with: | |
| team: fager | |
| image_suffix: backend | |
| tag: ${{ github.sha }} | |
| dockerfile: backend/Dockerfile | |
| docker_context: backend | |
| outputs: | |
| image: ${{ steps.docker-build-push.outputs.image }} | |
| deploy-dev: | |
| if: github.ref == 'refs/heads/main' | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| name: Deploy dev-gcp | |
| env: | |
| VAR: image=${{ needs.build.outputs.image }} | |
| RESOURCE: nais/dev-gcp-topic-bestillinger.yaml,nais/dev-gcp-backend.yaml | |
| CLUSTER: dev-gcp | |
| deploy-prod: | |
| if: github.ref == 'refs/heads/main' | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: nais/deploy/actions/deploy@v2 | |
| name: Deploy prod-gcp | |
| env: | |
| VAR: image=${{ needs.build.outputs.image }} | |
| RESOURCE: nais/prod-gcp-topic-bestillinger.yaml,nais/prod-gcp-backend.yaml | |
| CLUSTER: prod-gcp |