Skip to content

Commit 67dbd31

Browse files
authored
Build Docker image with Git tag, or latest if on main (#60)
1 parent a947e77 commit 67dbd31

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323

24-
- name: GitHub Tag Name example
25-
env:
26-
TAG: "${{ github.ref_name == 'main' && 'latest' || github.ref_name }}"
27-
run: |
28-
echo "Tag name: $TAG"
29-
3024
- name: Configure AWS Credentials
3125
uses: aws-actions/configure-aws-credentials@v4
3226
with:
@@ -47,5 +41,6 @@ jobs:
4741
- name: Build and push Docker images
4842
env:
4943
DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }}
44+
TAG: "${{ github.ref_name == 'main' && 'latest' || github.ref_name }}"
5045
run: |
5146
make image-push

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
TEST_TIMEOUT := 10s
44
SHELL := /bin/bash
5+
TAG ?= latest
56

67
all: lint test build
78

@@ -38,11 +39,11 @@ gen-mocks: bin/moq ./client/jsonrpc/ ./client/duneapi/
3839

3940
image-build:
4041
@echo "# Building Docker images"
41-
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v8 -t duneanalytics/node-indexer:latest -f Dockerfile .
42+
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v8 -t "duneanalytics/node-indexer:${TAG}" -f Dockerfile .
4243

4344
image-push:
4445
@echo "# Pushing Docker images to Docker Hub (after building)"
4546
echo -n "${DOCKER_HUB_KEY}" | docker login --username duneanalytics --password-stdin
4647
docker buildx create --name mybuilder
4748
docker buildx use mybuilder
48-
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v8 -t duneanalytics/node-indexer:latest -f Dockerfile --push .
49+
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v8 -t "duneanalytics/node-indexer:${TAG}" -f Dockerfile --push .

0 commit comments

Comments
 (0)