Bump docker/setup-buildx-action to v4 and docker/build-push-action to… #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Docker" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["master"] | |
| schedule: | |
| - cron: "0 8 * * 1" | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: "Test" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build image for testing | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: dockette/apidoc:latest-test | |
| platforms: linux/amd64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| load: true | |
| - name: Test Caddy is running | |
| run: | | |
| docker run --rm -d --name apidoc-test -p 8000:8000 dockette/apidoc:latest-test | |
| sleep 2 | |
| curl -sf http://localhost:8000/ > /dev/null | |
| echo "Landing page OK" | |
| - name: Test Swagger UI | |
| run: | | |
| curl -sf http://localhost:8000/swagger/ > /dev/null | |
| echo "Swagger UI OK" | |
| - name: Test Redoc | |
| run: | | |
| curl -sf http://localhost:8000/redoc/ > /dev/null | |
| echo "Redoc OK" | |
| - name: Test Stoplight Elements | |
| run: | | |
| curl -sf http://localhost:8000/elements/ > /dev/null | |
| echo "Stoplight Elements OK" | |
| - name: Test RapiDoc | |
| run: | | |
| curl -sf http://localhost:8000/rapidoc/ > /dev/null | |
| echo "RapiDoc OK" | |
| - name: Test Scalar | |
| run: | | |
| curl -sf http://localhost:8000/scalar/ > /dev/null | |
| echo "Scalar OK" | |
| - name: Cleanup | |
| if: always() | |
| run: docker stop apidoc-test || true | |
| build: | |
| name: "Build" | |
| needs: test | |
| uses: dockette/.github/.github/workflows/docker.yml@master | |
| secrets: inherit | |
| with: | |
| image: "dockette/apidoc" | |
| tag: "latest" | |
| context: "." | |
| platforms: "linux/amd64,linux/arm64" | |
| push: ${{ github.ref == 'refs/heads/master' }} | |
| readme: | |
| name: "Docker Hub README" | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Update Docker Hub description | |
| uses: peter-evans/dockerhub-description@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: dockette/apidoc |