-
Notifications
You must be signed in to change notification settings - Fork 10
34 lines (28 loc) · 921 Bytes
/
build.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
name: Build image
on:
push:
tags:
- "*"
workflow_dispatch:
env:
CI: true
REGISTRY: 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com
REPO: rabbykit-docs
jobs:
build-image:
runs-on: [self-hosted, Linux]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build, tag and push image to ECR
run: |
docker build -t ${REGISTRY}/${REPO}:${RELEASE_VERSION} -f Dockerfile .
docker tag ${REGISTRY}/${REPO}:${RELEASE_VERSION} ${REGISTRY}/${REPO}:latest
docker push ${REGISTRY}/${REPO}:${RELEASE_VERSION}
docker push ${REGISTRY}/${REPO}:latest
docker rmi ${REGISTRY}/${REPO}:${RELEASE_VERSION}
docker rmi ${REGISTRY}/${REPO}:latest