Skip to content

Commit 658a577

Browse files
committed
CI: also test image
1 parent 78038ce commit 658a577

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed

.github/workflows/docker.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,104 @@ jobs:
1313
docker:
1414
runs-on: ubuntu-latest
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
include:
1819
- dockerfile: ./adminer-dg/Dockerfile
20+
context: ./adminer-dg
1921
tag: dg
2022
platforms: linux/amd64,linux/arm64
2123

2224
- dockerfile: ./adminer-editor/Dockerfile
25+
context: ./adminer-editor
2326
tag: editor
2427
platforms: linux/amd64,linux/arm64
2528

2629
- dockerfile: ./adminer-full/Dockerfile
30+
context: ./adminer-full
2731
tag: full
2832
platforms: linux/amd64,linux/arm64
2933

3034
- dockerfile: ./adminer-mongo/Dockerfile
35+
context: ./adminer-mongo
3136
tag: mongo
3237
platforms: linux/amd64,linux/arm64
3338

3439
- dockerfile: ./adminer-mysql/Dockerfile
40+
context: ./adminer-mysql
3541
tag: mysql
3642
platforms: linux/amd64,linux/arm64
3743

3844
- dockerfile: ./adminer-oracle-11/Dockerfile
45+
context: ./adminer-oracle-11
3946
tag: oracle-11
4047
platforms: linux/amd64
4148

4249
- dockerfile: ./adminer-oracle-12/Dockerfile
50+
context: ./adminer-oracle-12
4351
tag: oracle-12
4452
platforms: linux/amd64
4553

4654
- dockerfile: ./adminer-postgres/Dockerfile
55+
context: ./adminer-postgres
4756
tag: postgres
4857
platforms: linux/amd64,linux/arm64
4958

5059
- dockerfile: ./adminer-full/Dockerfile
60+
context: ./adminer-full
5161
tag: latest
5262
platforms: linux/amd64,linux/arm64
5363

5464
name: Docker (dockette/adminer:${{ matrix.tag }})
5565

5666
steps:
57-
- name: Login to DockerHub
58-
uses: docker/login-action@v3
59-
with:
60-
username: ${{ secrets.DOCKERHUB_USERNAME }}
61-
password: ${{ secrets.DOCKERHUB_TOKEN }}
67+
- name: Checkout
68+
uses: actions/checkout@v4
6269

6370
- name: Set up QEMU
6471
uses: docker/setup-qemu-action@v3
6572

6673
- name: Set up Docker Buildx
6774
uses: docker/setup-buildx-action@v3
6875

69-
- name: Build and push
76+
- name: Login to DockerHub
77+
if: github.ref == 'refs/heads/master'
78+
uses: docker/login-action@v3
79+
with:
80+
username: ${{ secrets.DOCKERHUB_USERNAME }}
81+
password: ${{ secrets.DOCKERHUB_TOKEN }}
82+
83+
- name: Build image for testing (linux/amd64)
84+
uses: docker/build-push-action@v6
85+
with:
86+
context: ${{ matrix.context }}
87+
file: ${{ matrix.dockerfile }}
88+
push: false
89+
tags: dockette/adminer:${{ matrix.tag }}-test
90+
platforms: linux/amd64
91+
cache-from: type=gha
92+
cache-to: type=gha,mode=max
93+
load: true
94+
95+
- name: Test PHP version
96+
run: |
97+
docker run --rm dockette/adminer:${{ matrix.tag }}-test php --version
98+
99+
- name: Test HTTP server
100+
run: |
101+
CONTAINER_ID=$(docker run -d --rm -p 8080:80 dockette/adminer:${{ matrix.tag }}-test)
102+
sleep 5
103+
curl -f http://localhost:8080 | grep -i "adminer" || (docker logs $CONTAINER_ID && exit 1)
104+
docker stop $CONTAINER_ID
105+
106+
- name: Build and push to registry
107+
if: github.ref == 'refs/heads/master'
70108
uses: docker/build-push-action@v6
71109
with:
110+
context: ${{ matrix.context }}
72111
file: ${{ matrix.dockerfile }}
73112
push: true
74113
tags: dockette/adminer:${{ matrix.tag }}
75114
platforms: ${{ matrix.platforms }}
115+
cache-from: type=gha
116+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)