File tree 1 file changed +24
-3
lines changed
1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 9
9
type : string
10
10
11
11
jobs :
12
- docker- build-test :
13
- name : " Docker: Build & Test "
12
+ build :
13
+ name : " Docker: Build"
14
14
runs-on : ubuntu-latest
15
15
env :
16
16
DOCKERFILE : ' dev.Dockerfile'
@@ -20,17 +20,38 @@ jobs:
20
20
- name : Set up Docker Buildx
21
21
uses : docker/setup-buildx-action@v3
22
22
23
- - name : Build & Test
23
+ - name : Build
24
24
uses : docker/build-push-action@v5
25
25
with :
26
26
cache-from : type=gha
27
27
cache-to : type=gha,mode=max
28
28
file : ${{ env.DOCKERFILE }}
29
29
tags : ${{ github.event.repository.name }}:test
30
+ outputs : type=docker,dest=/tmp/${{ github.event.repository.name }}.tar
30
31
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
+
31
50
- name : Test
32
51
run : |
33
52
export WORKDIR=$(cat ${{ env.DOCKERFILE }} | grep WORKDIR | awk '{print $2}')
53
+
54
+ docker load --input /tmp/${{ github.event.repository.name }}.tar
34
55
docker run --name ${{ github.event.repository.name }} --rm ${{ github.event.repository.name }}:test
35
56
docker exec -it ${{ github.event.repository.name }} sh -c "cd ${WORKDIR} && ${{ github.event.inputs.test_cmd }}"
36
57
You can’t perform that action at this time.
0 commit comments