|
1 |
| -# SPDX-License-Identifier: BUSL-1.1 |
2 |
| -# |
3 |
| -# Copyright (C) 2023, Berachain Foundation. All rights reserved. |
4 |
| -# Use of this software is govered by the Business Source License included |
5 |
| -# in the LICENSE file of this repository and at www.mariadb.com/bsl11. |
6 |
| -# |
7 |
| -# ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY |
8 |
| -# TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER |
9 |
| -# VERSIONS OF THE LICENSED WORK. |
10 |
| -# |
11 |
| -# THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF |
12 |
| -# LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF |
13 |
| -# LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). |
14 |
| -# |
15 |
| -# TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON |
16 |
| -# AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, |
17 |
| -# EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF |
18 |
| -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND |
19 |
| -# TITLE. |
20 |
| - |
21 |
| -name: "docker-image-for-tag" |
| 1 | +name: Create and publish a Docker image |
22 | 2 |
|
23 | 3 | on:
|
24 | 4 | push:
|
25 | 5 | tags:
|
26 |
| - - 'v*.*.*' |
| 6 | + - '**' |
| 7 | + |
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_NAME: ${{ github.repository }} |
27 | 11 |
|
28 |
| -permissions: |
29 |
| - contents: read |
30 |
| - |
31 | 12 | jobs:
|
32 |
| - build-push-docker: |
33 |
| - runs-on: polaris-linux-latest |
| 13 | + build-and-push-image: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + |
34 | 19 | steps:
|
35 |
| - - name: Checkout repo |
36 |
| - uses: actions/checkout@v3 |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v2 |
37 | 22 |
|
38 | 23 | - name: Set up QEMU
|
39 | 24 | uses: docker/setup-qemu-action@v1
|
40 | 25 |
|
41 | 26 | - name: Set up Docker Buildx
|
42 | 27 | uses: docker/setup-buildx-action@v1
|
43 | 28 |
|
44 |
| - - name: Configure AWS credentials |
45 |
| - uses: aws-actions/configure-aws-credentials@v2 # More information on this action can be found below in the 'AWS Credentials' section |
| 29 | + - name: Log in to the Container registry |
| 30 | + uses: docker/login-action@v1 |
46 | 31 | with:
|
47 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
48 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
49 |
| - aws-region: us-east-2 |
| 32 | + registry: ${{ env.REGISTRY }} |
| 33 | + username: ${{ github.actor }} |
| 34 | + password: ${{ secrets.GH_TOKEN }} |
50 | 35 |
|
51 |
| - - name: Login to Amazon ECR |
52 |
| - id: login-ecr |
53 |
| - uses: aws-actions/amazon-ecr-login@v2 |
| 36 | + - name: Extract metadata (tags, labels) for Docker |
| 37 | + id: meta |
| 38 | + uses: docker/metadata-action@v3 |
54 | 39 | with:
|
55 |
| - mask-password: "true" |
56 |
| - run: | |
57 |
| - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/d4k0c7i3 |
| 40 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
58 | 41 |
|
59 |
| - - name: Build, tag, push amd64 docker image to Amazon ECR |
60 |
| - env: |
61 |
| - IMAGE_TAG: ${{ github.sha }} |
62 |
| - GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
63 |
| - run: | |
64 |
| - docker build --platform linux/amd64 -f ./build/docker/beacond.Dockerfile -t beacond:v0.0.0 --build-arg GIT_TOKEN=$GIT_TOKEN --build-arg GOARCH=amd64 . |
65 |
| - docker tag beacond:v0.0.0 public.ecr.aws/d4k0c7i3/beacond:amd64-$IMAGE_TAG |
66 |
| - docker push public.ecr.aws/d4k0c7i3/beacond:amd64-$IMAGE_TAG |
67 |
| - docker tag beacond:v0.0.0 public.ecr.aws/d4k0c7i3/beacond:amd64-latest |
68 |
| - docker push public.ecr.aws/d4k0c7i3/beacond:amd64-latest |
69 |
| -
|
70 |
| - - name: Build, tag, push arm64 docker image to Amazon ECR |
71 |
| - env: |
72 |
| - IMAGE_TAG: ${{ github.sha }} |
73 |
| - GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
74 |
| - run: | |
75 |
| - docker buildx build --platform linux/arm64 -f ./build/docker/beacond.Dockerfile -t beacond:v0.0.0 --build-arg GIT_TOKEN=$GIT_TOKEN --build-arg GOARCH=arm64 . |
76 |
| - docker tag beacond:v0.0.0 public.ecr.aws/d4k0c7i3/beacond:arm64-$IMAGE_TAG |
77 |
| - docker push public.ecr.aws/d4k0c7i3/beacond:arm-$IMAGE_TAG |
78 |
| - docker tag beacond:v0.0.0 public.ecr.aws/d4k0c7i3/beacond:arm64-latest |
79 |
| - docker push public.ecr.aws/d4k0c7i3/beacond:arm-latest |
| 42 | + - name: Build and push Docker image |
| 43 | + uses: docker/build-push-action@v4 |
| 44 | + with: |
| 45 | + context: . |
| 46 | + platforms: linux/amd64,linux/arm64 |
| 47 | + push: true |
| 48 | + tags: ${{ steps.meta.outputs.tags }} |
| 49 | + labels: ${{ steps.meta.outputs.labels }} |
| 50 | + build-args: | |
| 51 | + TAG=${{ github.ref_name }} |
0 commit comments