From bcacaa97b282205aba15d691ef529fc0346612ce Mon Sep 17 00:00:00 2001 From: Alex Kerney Date: Fri, 1 Jan 2021 19:16:54 -0500 Subject: [PATCH] Use Dependabot to check that the base image is up to date Extends #18 with Dependabot checking the base image to make sure it is up to date weekly. Github actions checks each push to make sure the image can be build, launched, and will return a 200 from the default ERDDAP page. When a commit is to the main or master branch, then the built image will be pushed to Docker Hub (if appropriate secrets are setup, and it is to Axiom's repo). --- .github/dependabot.yml | 6 ++++ .github/workflows/push.yml | 59 ++++++++++++++++++++++++++++++++++++++ README.md | 4 +++ 3 files changed, 69 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/push.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..504901c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: docker + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..4201f60 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,59 @@ +name: Push + +on: [push, workflow_dispatch] + +jobs: + build: + name: Build and test Docker Image + runs-on: ubuntu-20.04 + timeout-minutes: 10 + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Cache Docker Layers + uses: satackey/action-docker-layer-caching@v0.0.11 + continue-on-error: true + + - name: Login to Docker Hub + uses: azure/docker-login@v1 + continue-on-error: true + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker Image + run: docker build --tag axiom/docker-erddap:latest . + + - name: Run Docker Image in Background + run: docker run -d -p 8080:8080 axiom/docker-erddap:latest + + - name: Check that ERDDAP Docker Image will return a 200 + uses: ifaxity/wait-on-action@v1 + timeout-minutes: 1 + with: + resource: http://localhost:8080/erddap/index.html + + push: + name: Push latest image to Docker Hub + runs-on: ubuntu-20.04 + timeout-minutes: 10 + needs: build + if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && github.repository == 'axiom-data-science/docker-erddap' + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Cache Docker Layers + uses: satackey/action-docker-layer-caching@v0.0.11 + + - name: Login to Docker Hub + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push latest image to Docker Hub if on master or main branch of Axiom's repo + run: docker push axiom/docker-erddap:latest diff --git a/README.md b/README.md index a86179d..abf4eb9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ This repository will **not** back-port changes from the upstream image to existi (for example - SHA512 password hashes) you will have to wait for the next ERDDAP release which will be built with the newest upstream image. You can also build this image yourself. +Use `latest` image with caution as it follows the upstream image, and is not as thoroughly tested as tagged images. + +[Dependabot](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-dependencies-updated-automatically) is used to automatically make PRs to update the upstream image ([`.github/dependabot.yml`](.github/dependabot.yml)). + ## Quickstart ```bash