Skip to content

Commit eebf49a

Browse files
committed
fix(ci): docker test load image
1 parent 9f6e740 commit eebf49a

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

.github/workflows/docker_build_test.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
type: string
1010

1111
jobs:
12-
docker-build-test:
13-
name: "Docker: Build & Test"
12+
build:
13+
name: "Docker: Build"
1414
runs-on: ubuntu-latest
1515
env:
1616
DOCKERFILE: 'dev.Dockerfile'
@@ -20,17 +20,38 @@ jobs:
2020
- name: Set up Docker Buildx
2121
uses: docker/setup-buildx-action@v3
2222

23-
- name: Build & Test
23+
- name: Build
2424
uses: docker/build-push-action@v5
2525
with:
2626
cache-from: type=gha
2727
cache-to: type=gha,mode=max
2828
file: ${{ env.DOCKERFILE }}
2929
tags: ${{ github.event.repository.name }}:test
30+
outputs: type=docker,dest=/tmp/${{ github.event.repository.name }}.tar
3031

32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: myimage
36+
path: /tmp/${{ github.event.repository.name }}.tar
37+
38+
test:
39+
name: "Docker: Test"
40+
runs-on: ubuntu-latest
41+
env:
42+
DOCKERFILE: 'dev.Dockerfile'
43+
steps:
44+
- name: Download artifact
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: ${{ github.event.repository.name }}
48+
path: /tmp
49+
3150
- name: Test
3251
run: |
3352
export WORKDIR=$(cat ${{ env.DOCKERFILE }} | grep WORKDIR | awk '{print $2}')
53+
54+
docker load --input /tmp/${{ github.event.repository.name }}.tar
3455
docker run --name ${{ github.event.repository.name }} --rm ${{ github.event.repository.name }}:test
3556
docker exec -it ${{ github.event.repository.name }} sh -c "cd ${WORKDIR} && ${{ github.event.inputs.test_cmd }}"
3657

0 commit comments

Comments
 (0)