-
Notifications
You must be signed in to change notification settings - Fork 47
65 lines (58 loc) · 2.05 KB
/
docker.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Docker Release
defaults:
run:
shell: bash -leo pipefail {0}
on:
push:
tags:
- v**
env:
ECR_ENABLED: true
ECR_REPO: public.ecr.aws/l9h3g6c6/peggo
GHCR_ENABLED: false
GHCR_REPO: ghcr.io/InjectiveLabs/peggo
jobs:
docker-release:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout peggo
uses: actions/checkout@master
with:
repository: InjectiveLabs/peggo
fetch-depth: 0
ref: ${{ github.ref_name }}
token: ${{ secrets.GH_TOKEN }}
path: ./peggo
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Log-in to ghcr.io
if: env.GHCR_ENABLED == 'true'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login to Public ECR
if: env.ECR_ENABLED == 'true'
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_KEY }}
password: ${{ secrets.AWS_SECRET }}
env:
AWS_REGION: us-east-1
- name: Build image and push
run: |
cd peggo/
TAG=${{ github.ref_name }}
echo $TAG
[[ $ECR_ENABLED == "false" ]] || docker buildx build --tag $ECR_REPO:$TAG --platform linux/amd64,linux/arm64 --push .
[[ $GHCR_ENABLED == "false" ]] || docker buildx build --tag $GHCR_REPO:$TAG --platform linux/amd64,linux/arm64 --push .
- name: NONROOT Build image and push
run: |
cd peggo/
TAG=${{ github.ref_name }}-nonroot
echo $TAG
[[ $ECR_ENABLED == "false" ]] || docker buildx build -f Dockerfile.nonroot --tag $ECR_REPO:$TAG --platform linux/amd64,linux/arm64 --push .
[[ $GHCR_ENABLED == "false" ]] || docker buildx build -f Dockerfile.nonroot --tag $GHCR_REPO:$TAG --platform linux/amd64,linux/arm64 --push .