-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.2 KB
/
build-image.yml
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
38
name: Build Image
on: push
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
# TODO: use OIDC for auth:
# https://github.com/aws-actions/configure-aws-credentials#assuming-a-role
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push docker image to Amazon ECR
uses: docker/build-push-action@v4
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: dse-infra-dev-us-west-2-default
IMAGE_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || 'test' }}
with:
push: true
context: "."
file: "./images/Dockerfile"
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}