|
| 1 | +name: Build A3S Docker Image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: 'Branch to build Docker image from' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - mz/js-985-a3s-docker-workflow |
| 13 | + |
| 14 | +jobs: |
| 15 | + get_build_number: |
| 16 | + runs-on: github-ubuntu-latest-s |
| 17 | + name: Get build number |
| 18 | + permissions: |
| 19 | + id-token: write |
| 20 | + contents: read |
| 21 | + outputs: |
| 22 | + BUILD_NUMBER: ${{ steps.get-build-number.outputs.BUILD_NUMBER }} |
| 23 | + steps: |
| 24 | + - uses: SonarSource/ci-github-actions/get-build-number@master |
| 25 | + id: get-build-number |
| 26 | + |
| 27 | + build_and_publish: |
| 28 | + name: Build and publish Docker image |
| 29 | + runs-on: github-ubuntu-latest-m |
| 30 | + needs: get_build_number |
| 31 | + environment: Staging |
| 32 | + permissions: |
| 33 | + id-token: write |
| 34 | + contents: read |
| 35 | + env: |
| 36 | + BUILD_NUMBER: ${{ needs.get_build_number.outputs.BUILD_NUMBER }} |
| 37 | + steps: |
| 38 | + - name: Checkout source code |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + ref: ${{ inputs.branch || github.ref }} |
| 42 | + |
| 43 | + - uses: jdx/mise-action@v3.5.1 |
| 44 | + with: |
| 45 | + version: 2025.11.2 |
| 46 | + mise_toml: | |
| 47 | + [tools] |
| 48 | + node = "24.11.0" |
| 49 | +
|
| 50 | + - name: Access vault secrets |
| 51 | + id: secrets |
| 52 | + uses: SonarSource/vault-action-wrapper@v3 |
| 53 | + with: |
| 54 | + secrets: | |
| 55 | + development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN; |
| 56 | +
|
| 57 | + - name: Configure npm registry |
| 58 | + run: | |
| 59 | + npm config set //repox.jfrog.io/artifactory/api/npm/:_authToken=${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }} |
| 60 | + npm config set registry https://repox.jfrog.io/artifactory/api/npm/npm/ |
| 61 | +
|
| 62 | + - name: Install NPM dependencies |
| 63 | + run: npm ci |
| 64 | + |
| 65 | + - name: Build bundle for Docker |
| 66 | + run: npm run grpc:build |
| 67 | + |
| 68 | + - name: Configure AWS credentials |
| 69 | + uses: aws-actions/configure-aws-credentials@v4 |
| 70 | + with: |
| 71 | + role-to-assume: arn:aws:iam::718197818630:role/${{ vars.CICD_ROLE }} |
| 72 | + aws-region: eu-central-1 |
| 73 | + |
| 74 | + - name: Login to Amazon ECR |
| 75 | + id: login-ecr |
| 76 | + uses: aws-actions/amazon-ecr-login@v2 |
| 77 | + with: |
| 78 | + registries: "982534363626" # SharedServices Dev Account |
| 79 | + |
| 80 | + - name: Set up Docker Buildx |
| 81 | + uses: docker/setup-buildx-action@v3 |
| 82 | + |
| 83 | + - name: Build and push Docker image |
| 84 | + uses: docker/build-push-action@v6 |
| 85 | + with: |
| 86 | + context: . |
| 87 | + file: Dockerfile |
| 88 | + push: true |
| 89 | + platforms: linux/arm64 |
| 90 | + tags: | |
| 91 | + ${{ steps.login-ecr.outputs.registry }}/a3s/javascript:${{ env.BUILD_NUMBER }} |
| 92 | + ${{ steps.login-ecr.outputs.registry }}/a3s/javascript:latest |
0 commit comments