Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check if a Docker image can be built
name: Build and test a Docker image

on:
push:
Expand All @@ -10,18 +10,6 @@ jobs:
docker_build:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0.22
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: index_digest
MYSQL_USER: test
MYSQL_PASSWORD: p4ss
ports:
- "53306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: actions/checkout@v1

Expand All @@ -36,15 +24,33 @@ jobs:
--build-arg COMMIT_SHA=$(git rev-parse --short HEAD) \
--tag ${{ github.repository }}
docker images
docker inspect --format='{{json .Config.Labels}}' ${{ github.repository }} | jq

docker ps
echo "## Image labels:"
docker inspect --format='{{json .Config.Labels}}' ${{ github.repository }} | jq

- name: Check the version
run: |
docker run ${{ github.repository }} --version


docker_test:
runs-on: ubuntu-latest
needs: docker_build

services:
mysql:
image: mysql:8.0.22
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: index_digest
MYSQL_USER: test
MYSQL_PASSWORD: p4ss
ports:
- "53306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Run the container and connect to the test database
run: |
docker ps
docker run --network=host ${{ github.repository }} mysql://test:[email protected]:53306/index_digest | tee /tmp/results
grep "Jolly, good! No issues to report" /tmp/results