Skip to content

Commit 5c0174f

Browse files
committed
Next attempt.
1 parent 3cb3712 commit 5c0174f

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

.github/workflows/docker.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
username: ${{ github.actor }}
3535
password: ${{ secrets.GITHUB_TOKEN }}
3636

37-
- name: Test
38-
run: make test
39-
4037
- name: Make tag
4138
run: |
4239
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
@@ -46,6 +43,20 @@ jobs:
4643
- name: Set up Docker Buildx
4744
uses: docker/setup-buildx-action@v3
4845

46+
- name: Build and export minimal image to Docker
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
load: true
51+
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.tag }}-minimal
52+
target: minimal
53+
54+
- name: Test
55+
run: |
56+
make test
57+
env:
58+
VERSION: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.tag }}-minimal
59+
4960
- name: Build and push minimal image
5061
uses: docker/build-push-action@v6
5162
with:

Dockerfile.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
FROM metal-deployment-base
1+
ARG VERSION=metal-deployment-base
2+
FROM ${VERSION}
23
COPY test .

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
VERSION := $(or $(VERSION),metal-deployment-base)
12
ifeq ($(CI),true)
23
DOCKER_RUN_ARG=
34
else
45
DOCKER_RUN_ARG=t
56
endif
67

8+
.PHONY: build
9+
build:
10+
docker build -t $(VERSION) .
11+
712
.PHONY: test
813
test:
9-
docker build -t metal-deployment-base .
10-
docker build -t metal-deployment-base-test -f Dockerfile.test .
11-
docker run --rm -i$(DOCKER_RUN_ARG) metal-deployment-base-test bash -c \
14+
docker build -t $(VERSION)-test -f Dockerfile.test --build-arg=$(VERSION) .
15+
docker run --rm -i$(DOCKER_RUN_ARG) $(VERSION)-test bash -c \
1216
'ansible -m metalstack.base.metal_stack_release_vector localhost && find ~/.ansible/roles -maxdepth 1 -type d -ls'

0 commit comments

Comments
 (0)