Skip to content

Commit

Permalink
Build Docker images for both arm and amd
Browse files Browse the repository at this point in the history
  • Loading branch information
vegarsti committed Jun 18, 2024
1 parent e231198 commit 90aa08f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
name: "Build"

on:
push:
branches:
- main
# on:
# push:
# branches:
# - main

on: pull_request

jobs:
build:
Expand All @@ -29,6 +31,11 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Install prerequisites for Docker build
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- env:
GITHUB_TOKEN: ${{ secrets.DUNE_ENG_ACCESS_TOKEN }}
ECR_REGISTRY: public.ecr.aws/duneanalytics
Expand Down
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.PHONY: all setup lint build test image-build image-push

APPLICATION := indexer
GITHUB_SHA ?= HEAD
REF_TAG := $(shell echo ${GITHUB_REF_NAME} | tr -cd '[:alnum:]')
IMAGE_TAG := ${ECR_REGISTRY}/${ECR_REPOSITORY}:${REF_TAG}-$(shell git rev-parse --short "${GITHUB_SHA}")-${GITHUB_RUN_NUMBER}
Expand Down Expand Up @@ -38,11 +37,16 @@ gen-mocks: bin/moq ./client/jsonrpc/ ./client/duneapi/


image-build:
@echo "# Building indexer docker image..."
docker build -t $(APPLICATION) -f Dockerfile --build-arg GITHUB_TOKEN=${GITHUB_TOKEN} .
@echo "# Building indexer docker image for amd64 and arm64"
docker buildx build --platform linux/amd64 -t ${IMAGE_TAG}-amd64 -f Dockerfile --build-arg GITHUB_TOKEN=${GITHUB_TOKEN} .
docker buildx build --platform linux/arm64 -t ${IMAGE_TAG}-arm64 -f Dockerfile --build-arg GITHUB_TOKEN=${GITHUB_TOKEN} .

image-push: image-build
@echo "# Pushing indexer docker image..."
docker tag $(APPLICATION) ${IMAGE_TAG}
# docker push ${IMAGE_TAG}
docker rmi ${IMAGE_TAG}
@echo "# Pushing indexer docker images"
# docker manifest create --insecure "${IMAGE_TAG}" "${IMAGE_TAG}-amd64"
# docker manifest create -a "${IMAGE_TAG}" "${IMAGE_TAG}-arm64" --insecure
# docker manifest push "${IMAGE_TAG}" --insecure
docker push "${IMAGE_TAG}-amd64"
docker push "${IMAGE_TAG}-arm64"
docker rmi "${IMAGE_TAG}-amd64"
docker rmi "${IMAGE_TAG}-arm64"

0 comments on commit 90aa08f

Please sign in to comment.