Skip to content

Commit 22164a5

Browse files
zgliczvdiezclaude
committed
Add A3S Docker image build and publish workflow (JS-985) (#6079)
Co-authored-by: Victor Diez <victor.diez@sonarsource.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fabe217 commit 22164a5

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/docker-a3s.yml

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

0 commit comments

Comments
 (0)