Skip to content

Commit

Permalink
ci: update build-image workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 4, 2023
1 parent 67b7b83 commit a63b246
Showing 1 changed file with 11 additions and 48 deletions.
59 changes: 11 additions & 48 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,22 @@ on:
push:
branches:
- main
- 'ci/update-workflow'
tags:
- "v*"
- 'v*'
paths:
- "backend/**"
- 'backend/**'
workflow_dispatch:

name: Build Docker image

jobs:
build-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::166485377238:role/github-actions-onghub-ecr
aws-region: eu-west-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: ${{ steps.login-ecr.outputs.registry }}/teo
tags: |
type=edge
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v3
with:
context: backend
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build:
name: Build Docker image
uses: code4romania/.github/.github/workflows/build-push-image-ecr.yml@main
with:
image_name: vic
region: eu-west-1
secrets:
role_to_assume: ${{ secrets.ROLE_TO_ASSUME }}

0 comments on commit a63b246

Please sign in to comment.