forked from ministryofjustice/fb-av
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (34 loc) · 1.19 KB
/
build_image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Build and upload docker images
on:
push:
branches:
- '**'
permissions:
id-token: write # for JWT request
contents: read # for actions/checkout
jobs:
docker-image-build:
name: docker-image-build
runs-on: ubuntu-latest
environment: preprod
steps:
- name: Checkout repo
uses: actions/[email protected]
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-2
role-session-name: github-aws-access
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: Build fb-av, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: "fb-av"
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t ${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} .
docker tag ${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}