Skip to content

Commit

Permalink
ci(): build linux amd64 image to ecr
Browse files Browse the repository at this point in the history
  • Loading branch information
ivyxjc committed Sep 14, 2023
1 parent d21debd commit b6f7601
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build ECR

on:
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag'
default: 'v1.49.0-flexcompute'
type: string
required: false
imageTag:
description: 'imageTag'
required: true
type: string
default: 'v1.49.0-flexcompute'

concurrency:
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
cancel-in-progress: true

# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
permissions:
contents: read

jobs:
all-in-one:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs

- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
submodules: true

- name: Fetch git tags
run: |
git fetch --prune --unshallow --tags
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: 1.21.x

- name: Setup Node.js version
uses: ./.github/actions/setup-node.js

- name: Export BRANCH variable
uses: ./.github/actions/setup-branch

- name: Install tools
run: make install-ci

- uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ACCESS_SECRET }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1


- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: public.ecr.aws/a8c8b9j3/jaegertracing/all-in-one
tags: |
${{ inputs.imageTag }}
- run: make create-baseimg create-debugimg
- run: make build-all-platforms

- name: Docker build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: cmd/all-in-one/Dockerfile
build-args: |
base_image=localhost:5000/baseimg_alpine:latest
debug_image=localhost:5000/debugimg_alpine:latest
TARGETARCH=amd64
push: true
context: cmd/all-in-one
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit b6f7601

Please sign in to comment.