Update Docker Compose and Traefik configuration: adjust Vault user, p… #7
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: Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: deploy | |
| cancel-in-progress: false | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-and-push: | |
| name: Build & Push Images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| strategy: | |
| matrix: | |
| service: | |
| - name: auth-api | |
| dockerfile: services/auth-api/Dockerfile | |
| - name: assistant-api | |
| dockerfile: services/assistant-api/Dockerfile | |
| - name: auth-ui | |
| dockerfile: services/auth-ui/Dockerfile | |
| - name: assistant-ui | |
| dockerfile: services/assistant-ui/Dockerfile | |
| - name: app-ui | |
| dockerfile: services/app-ui/Dockerfile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set image prefix (lowercase) | |
| run: echo "IMAGE_PREFIX=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ matrix.service.dockerfile }} | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.service.name }}:${{ github.sha }} | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.service.name }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy: | |
| name: Deploy to Swarm | |
| runs-on: ubuntu-latest | |
| needs: [build-and-push] | |
| environment: production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| port: 2222 | |
| script: | | |
| cd /opt/private-stack | |
| docker stack deploy -c docker-compose.prod.yml private-stack --with-registry-auth | |
| post-deploy-smoke: | |
| name: Post-Deploy Smoke Tests | |
| runs-on: ubuntu-latest | |
| needs: [deploy] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - uses: gradle/actions/setup-gradle@v4 | |
| - name: Run smoke tests | |
| env: | |
| TEST_BASE_URL: https://jorisjonkers.dev | |
| run: | | |
| ./gradlew :services:system-tests:test \ | |
| -Dtest.base-url="$TEST_BASE_URL" \ | |
| || true |