diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2a94916..a50a73b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,7 +4,11 @@ updates: directory: '/' schedule: interval: 'weekly' + assignees: + - 'bbortt' - package-ecosystem: 'docker' directory: '/' schedule: interval: 'weekly' + assignees: + - 'bbortt' diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ee13358..666b030 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,8 +1,10 @@ name: build -on: [push, pull_request] - +on: + push: + branches: + - '**/*' jobs: - release: + test: runs-on: ubuntu-latest steps: - name: Checkout @@ -17,14 +19,27 @@ jobs: type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and Push + - name: Build uses: docker/build-push-action@v3 with: - push: ${{ github.event_name != 'pull_request' }} + context: . + load: true + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + - name: Test + run: | + docker run \ + --rm \ + --name swagger-ui-test \ + -p 8080:8080 \ + -e POLL_INTERVAL_SECONDS=60 \ + -e POLL_URL=https://raw.githubusercontent.com/bbortt/swagger-ui-demo/master/swagger-config.json \ + ${{ steps.meta.outputs.tags }} & \ + ( + sleep 10 && \ + if [[ $(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:8080) -ne 200 ]]; then + exit 1; + fi && \ + docker container stop swagger-ui-test + ) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..38a5599 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,32 @@ +name: build +on: + push: + branches: + - release +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Docker Metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: postfinance/polling-swagger-ui + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and Push + uses: docker/build-push-action@v3 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 042c8e7..de36204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM swaggerapi/swagger-ui:v4.12.0 +FROM swaggerapi/swagger-ui:v4.14.0 MAINTAINER OpenSource PF ENV CONFIG_URL /apis/swagger-config.json diff --git a/README.md b/README.md index a0a2193..a721aaf 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ The following command demonstrates a sample container start: docker run \ --rm \ -p 80:8080 \ - -e POLL_INTERVAL_SECONDS=60 + -e POLL_INTERVAL_SECONDS=60 \ -e POLL_URL=https://raw.githubusercontent.com/bbortt/swagger-ui-demo/master/swagger-config.json \ postfinance/polling-swagger-ui:1.0.0 ``` diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 9da7bfa..ff45974 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -3,4 +3,4 @@ # Docker entrypoint starting nginx as well as the polling process. # Original CMD ["sh", "/usr/share/nginx/run.sh"]: https://github.com/swagger-api/swagger-ui/blob/master/Dockerfile. -/appl/polling-swagger-ui/poll-monitor.sh & /docker-entrypoint.sh sh /usr/share/nginx/run.sh +/appl/polling-swagger-ui/poll-monitor.sh & /docker-entrypoint.sh sh -c "nginx -g \"daemon off;\""