mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2024-11-01 00:21:46 +01:00
Test docker image before pushing to docker hub (#111)
* 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
This commit is contained in:
parent
4be928f6d0
commit
e52061d4fa
3 changed files with 12 additions and 1 deletions
10
.github/workflows/image.yml
vendored
10
.github/workflows/image.yml
vendored
|
@ -16,6 +16,16 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Test Bash scripts
|
- name: Test Bash scripts
|
||||||
run: sudo apt-get -qq update && sudo apt-get install -y devscripts shellcheck && make test
|
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:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: test
|
needs: test
|
||||||
|
|
|
@ -44,4 +44,4 @@ VOLUME ["/backup"]
|
||||||
HEALTHCHECK --interval=2s --retries=1800 \
|
HEALTHCHECK --interval=2s --retries=1800 \
|
||||||
CMD stat /HEALTHY.status || exit 1
|
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
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
if [ "$#" -ne 1 ]
|
if [ "$#" -ne 1 ]
|
||||||
then
|
then
|
||||||
echo "You must pass the path of the backup file to restore"
|
echo "You must pass the path of the backup file to restore"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
Loading…
Reference in a new issue