mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-19 08:42:34 +01:00
e52061d4fa
* 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
53 lines
No EOL
1.6 KiB
YAML
53 lines
No EOL
1.6 KiB
YAML
name: build docker image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags:
|
|
- "**"
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout the code
|
|
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
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v4
|
|
# https://github.com/docker/setup-qemu-action
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
# https://github.com/docker/setup-buildx-action
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Get latest release version number
|
|
id: docker-tag
|
|
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Build multiarch image
|
|
run: |
|
|
docker buildx build --push \
|
|
--tag fradelg/mysql-cron-backup:${{ steps.docker-tag.outputs.tag }} \
|
|
--platform linux/amd64,linux/arm/v7,linux/arm64 . |