Skip to content

Commit

Permalink
ci: use bake also for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Apr 3, 2024
1 parent 2e0314e commit 0152215
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
13 changes: 13 additions & 0 deletions .dive-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules:
# If the efficiency is measured below X%, mark as failed.
# Expressed as a ratio between 0-1.
lowestEfficiency: 0.95

# If the amount of wasted space is at least X or larger than X, mark as failed.
# Expressed in B, KB, MB, and GB.
highestWastedBytes: 20MB

# If the amount of wasted space makes up for X% or more of the image, mark as failed.
# Note: the base image layer is NOT included in the total image size.
# Expressed as a ratio between 0-1; fails if the threshold is met or crossed.
highestUserWastedPercent: 0.20
33 changes: 16 additions & 17 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,23 @@ jobs:
prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-
- name: 🧪 Bake image for testing
uses: docker/build-push-action@v5
id: bake
uses: docker/bake-action@v4
with:
context: ./dist/base/${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
platforms: linux/${{ matrix.builder.arch }}
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
cache-to: type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
targets: ${{ env.TARGET }}
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
set: |
*.tags=
*.platform=linux/${{ matrix.builder.arch }}
*.cache-from=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
*.output=type=docker,"name=${{ env.DOCKER_NAMESPACE }},${{ env.GHCR_NAMESPACE }}",name-canonical=true,push=false
- name: 💻 Display tags built
run: |
docker image ls --filter="reference=${{ env.DOCKER_NAMESPACE }}" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}"
- name: 🧪 Test Docker image
run: |
Expand Down Expand Up @@ -233,14 +240,6 @@ jobs:
if-no-files-found: error
retention-days: 1

# - name: 📤 Upload digest
# uses: actions/upload-artifact@v4
# with:
# name: digests
# path: /tmp/digests/*
# if-no-files-found: error
# retention-days: 1

merge:
needs: build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export DOCKER_BUILDKIT ?= 1
export COMPOSE_DOCKER_CLI_BUILD ?= 1

IMAGE_NAMESPACE ?= wayofdev/php-base
IMAGE_TEMPLATE ?= 8.1-fpm-alpine
IMAGE_TEMPLATE ?= 8.1-supervisord-alpine
IMAGE_TAG ?= $(IMAGE_NAMESPACE):$(IMAGE_TEMPLATE)-latest

DOCKERFILE_DIR ?= ./dist/base/$(IMAGE_TEMPLATE)
Expand Down

0 comments on commit 0152215

Please sign in to comment.