-
Notifications
You must be signed in to change notification settings - Fork 36
59 lines (50 loc) · 1.53 KB
/
_build.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: build image
on:
workflow_call:
inputs:
image-tags:
type: string
required: true
description: "comma separated container image tags"
role-to-assume:
description: "role arn to be assumed"
default: 'arn:aws:iam::887442827229:role/GithubActions_decidim-cfj-cdk-deploy'
type: string
required: false
deploy-env:
type: string
required: false
description: "target environment"
default: staging
secrets:
aws-ecr-repo-name:
required: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: "ap-northeast-1"
role-duration-seconds: 1200
role-to-assume: "${{ inputs.role-to-assume }}"
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Docker Build
uses: docker/build-push-action@v3
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.login-ecr.outputs.registry }}/${{ secrets.aws-ecr-repo-name }}:${{ inputs.deploy-env }}-${{ inputs.image-tags }}
file: ./Dockerfile
context: ./
cache-from: type=gha
cache-to: type=gha,mode=max