|
| 1 | +name: Push |
| 2 | + |
| 3 | +on: [push, workflow_dispatch] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + name: Build and test Docker Image |
| 8 | + runs-on: ubuntu-20.04 |
| 9 | + timeout-minutes: 10 |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v1 |
| 14 | + |
| 15 | + - name: Cache Docker Layers |
| 16 | + |
| 17 | + continue-on-error: true |
| 18 | + |
| 19 | + - name: Login to Docker Hub |
| 20 | + uses: azure/docker-login@v1 |
| 21 | + continue-on-error: true |
| 22 | + with: |
| 23 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 24 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 25 | + |
| 26 | + - name: Build Docker Image |
| 27 | + run: docker build --tag axiom/docker-erddap:latest . |
| 28 | + |
| 29 | + - name: Run Docker Image in Background |
| 30 | + run: docker run -d -p 8080:8080 axiom/docker-erddap:latest |
| 31 | + |
| 32 | + - name: Check that ERDDAP Docker Image will return a 200 |
| 33 | + uses: ifaxity/wait-on-action@v1 |
| 34 | + timeout-minutes: 1 |
| 35 | + with: |
| 36 | + resource: http://localhost:8080/erddap/index.html |
| 37 | + |
| 38 | + push: |
| 39 | + name: Push latest image to Docker Hub |
| 40 | + runs-on: ubuntu-20.04 |
| 41 | + timeout-minutes: 10 |
| 42 | + needs: build |
| 43 | + if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && github.repository == 'axiom-data-science/docker-erddap' |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v1 |
| 48 | + |
| 49 | + - name: Cache Docker Layers |
| 50 | + |
| 51 | + |
| 52 | + - name: Login to Docker Hub |
| 53 | + uses: azure/docker-login@v1 |
| 54 | + with: |
| 55 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 56 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 57 | + |
| 58 | + - name: Push latest image to Docker Hub if on master or main branch of Axiom's repo |
| 59 | + run: docker push axiom/docker-erddap:latest |
0 commit comments