|
| 1 | +name: Dev Build and Push Images |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + # Step 0: Create tag environment variable |
| 9 | + set-tag: |
| 10 | + runs-on: self-hosted |
| 11 | + outputs: |
| 12 | + tag: ${{ steps.tag.outputs.tag }} |
| 13 | + steps: |
| 14 | + - name: Create tag name |
| 15 | + id: tag |
| 16 | + run: echo "::set-output name=tag::$(date +'%Y-%m-%dT%H-%M-%S')_${GITHUB_SHA}" |
| 17 | + |
| 18 | + # Reusable job to build and push an agent image |
| 19 | + build-push-image: |
| 20 | + needs: set-tag |
| 21 | + runs-on: self-hosted |
| 22 | + container: |
| 23 | + image: registry.dev.nudgebee.pollux.in/profiler-vm:latest |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + agent: [jvm, bpf, python, perf] |
| 27 | + dockerfile: [docker/jvm/alpine/Dockerfile, docker/bpf/Dockerfile, docker/python/Dockerfile, docker/perf/Dockerfile] |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Configure AWS Credentials |
| 33 | + uses: aws-actions/configure-aws-credentials@v1 |
| 34 | + with: |
| 35 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 36 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 37 | + aws-region: us-east-1 |
| 38 | + |
| 39 | + - name: Login to Amazon ECR |
| 40 | + uses: aws-actions/amazon-ecr-login@v1 |
| 41 | + |
| 42 | + - name: Build and Push Agent Image |
| 43 | + uses: docker/build-push-action@v3 |
| 44 | + with: |
| 45 | + context: . |
| 46 | + file: ${{ matrix.dockerfile }} |
| 47 | + push: true |
| 48 | + tags: 864186153326.dkr.ecr.us-east-1.amazonaws.com/nudgebee-profiler-${{ matrix.agent }}:${{ needs.set-tag.outputs.tag }} |
| 49 | + cache-from: type=registry,ref=864186153326.dkr.ecr.us-east-1.amazonaws.com/nudgebee-profiler-${{ matrix.agent }}:latest |
| 50 | + cache-to: type=registry,ref=864186153326.dkr.ecr.us-east-1.amazonaws.com/nudgebee-profiler-${{ matrix.agent }}:cache,mode=max |
0 commit comments