Skip to content

Commit

Permalink
feat(docker): Use buildx to generate multiplatform builds
Browse files Browse the repository at this point in the history
Signed-off-by: Rodney Osodo <[email protected]>
  • Loading branch information
rodneyosodo committed May 11, 2024
1 parent 75db28c commit 8725456
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
build-and-push:
name: Build and Push
Expand All @@ -23,17 +26,17 @@ jobs:
go-version: 1.21.x
cache-dependency-path: "go.sum"

- name: Run tests
run: |
make test
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV }}
directory: ./coverage/
name: codecov-umbrella
verbose: true
# - name: Run tests
# run: |
# make test

# - name: Upload coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV }}
# directory: ./coverage/
# name: codecov-umbrella
# verbose: true

- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

MG_DOCKER_IMAGE_NAME_PREFIX ?= magistrala
MG_DOCKER_IMAGE_NAME_PREFIX ?= rodneydav
BUILD_DIR = build
SERVICES = auth users things http coap ws lora influxdb-writer influxdb-reader mongodb-writer \
mongodb-reader cassandra-writer cassandra-reader postgres-writer postgres-reader timescale-writer timescale-reader cli \
Expand Down Expand Up @@ -48,7 +48,8 @@ endef
define make_docker
$(eval svc=$(subst docker_,,$(1)))

docker build \
docker buildx build \
--platform linux/386,linux/amd64,linux/arm/v7,linux/arm64 \
--no-cache \
--build-arg SVC=$(svc) \
--build-arg GOARCH=$(GOARCH) \
Expand Down

0 comments on commit 8725456

Please sign in to comment.