Skip to content

Commit 0ad19b8

Browse files
committed
fixup! fixup! WIP: add debian package builder
improve docker build cache
1 parent 1c5813b commit 0ad19b8

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/debian.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ jobs:
3232
- name: Set up QEMU
3333
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
3434

35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
37+
3538
- name: Make builder container image
3639
working-directory: debian
37-
run: make image TARGET_ARCH=${{ matrix.target-arch }}
40+
run: |
41+
make image TARGET_ARCH=${{ matrix.target-arch }} \
42+
DOCKER_BUILD_FLAGS="--cache-from type=gha,scope=${{ matrix.target-arch }} --cache-to type=gha,scope=${{ matrix.target-arch }},mode=max"
3843
3944
- name: Build packages
4045
working-directory: debian

debian/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,16 @@ exec: ## Execute a COMMAND inside an image for given TARGET_ARCH
9595
apt-get update -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/cartesi-deb-apt.list -o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0 || true) && \
9696
$(COMMAND)"
9797

98+
DOCKER_BUILD_FLAGS=
99+
98100
image: ## Build Docker image for building packages for given TARGET_ARCH
99-
docker build --platform=linux/$(TARGET_ARCH) \
101+
docker buildx build --platform=linux/$(TARGET_ARCH) \
100102
--build-arg=BASE_IMAGE=$(BASE_IMAGE) \
101103
--tag=$(IMAGE) \
104+
--load \
102105
--progress=plain \
103-
--file Dockerfile .
106+
--file Dockerfile \
107+
$(DOCKER_BUILD_FLAGS) .
104108

105109
test: ## Test built packages for all architectures (amd64/arm64/riscv64)
106110
@$(MAKE) --no-print-directory test-packages TARGET_ARCH=amd64

0 commit comments

Comments
 (0)