From de4f129106c49f3c321a59a4b71a474f6adfa3ef Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Tue, 13 Sep 2022 16:32:53 -0600 Subject: [PATCH] Add workflow --- .github/workflows/docker.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..236ff8f0 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,54 @@ +name: github-docker + +on: + push: + branches: + - 'master' + release: + types: [created] + +concurrency: + group: docker-build + cancel-in-progress: true + +permissions: + contents: read + packages: write + +jobs: + build-docker: + runs-on: ubuntu-latest + if: github.repository == 'geodynamics/rayleigh' + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_LOGIN }} + + - name: Build and push Docker image for master + if: contains(github.event_name, 'push') + uses: docker/build-push-action@v3 + with: + context: ./docker/rayleigh/ + cache-from: type=registry,ref=geodynamics/rayleigh-buildenv-bionic + cache-to: type=inline + push: true + tags: geodynamics/rayleigh:latest + + - name: Build and push Docker image for release + if: contains(github.event_name, 'release') + uses: docker/build-push-action@v3 + with: + context: ./docker/rayleigh/ + cache-from: type=registry,ref=geodynamics/rayleigh-buildenv-bionic + cache-to: type=inline + push: true + tags: geodynamics/rayleigh:${{github.ref_name}} +