Skip to content

Commit

Permalink
Test docker image before pushing to docker hub (#111)
Browse files Browse the repository at this point in the history
* update dockerize docker instructions

* use go with alpine

* login to docker hub using action too

* test docker image before building

* extract command from the entrypoint

* change volume path

* user docker compose run and cmd instead entrypoint
  • Loading branch information
fradelg authored Sep 17, 2023
1 parent 4be928f commit e52061d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:
uses: actions/checkout@v4
- name: Test Bash scripts
run: sudo apt-get -qq update && sudo apt-get install -y devscripts shellcheck && make test
- name: Test image
env:
VOLUME_PATH: /tmp/mariadb
DATABASE_NAME: foo
MARIADB_ROOT_PASSWORD: abcd
run: |
docker-compose up -d mariadb
docker-compose run backup /backup.sh
docker-compose run backup /restore.sh /backup/latest.foo.sql.gz
docker-compose stop
build:
runs-on: ubuntu-22.04
needs: test
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ VOLUME ["/backup"]
HEALTHCHECK --interval=2s --retries=1800 \
CMD stat /HEALTHY.status || exit 1

ENTRYPOINT dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
1 change: 1 addition & 0 deletions restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
if [ "$#" -ne 1 ]
then
echo "You must pass the path of the backup file to restore"
exit 1
fi

set -o pipefail
Expand Down

0 comments on commit e52061d

Please sign in to comment.