Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/doe 150 reusable build container workflow #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 11 additions & 33 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
name: Build and Push Python Frontend

on:
push:
pull_request:
branches:
- main

permissions:
packages: read
contents: read
contents: write
security-events: write
statuses: write
checks: write
id-token: write
actions: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
env:
AWS_ACCOUNT_ID: "${{ secrets.AWS_ACCOUNT_ID }}"
AWS_ROLE_NAME: "${{ secrets.AWS_ROLE_NAME }}"
with:
aws-region: "eu-west-2"
role-to-assume: "arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.AWS_ROLE_NAME }}"

- name: Log in to Amazon AWS
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr

- name: Build and push Docker image
uses: docker/build-push-action@v5
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: hello-world-frontend
IMAGE_TAG: latest
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
uses: ukhsa-collaboration/devops-github-reusable-workflows/.github/workflows/container-image-build.yml@feature/doe-150-reusable-container-build
with:
release_after_build: true
image_name: hello-world-frontend
secrets:
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}

Loading