ci: Reduce waiting time #132
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 Image CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 3 1,15 * *' | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| runner: [ ubuntu-24.04-arm, ubuntu-latest ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - | |
| name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ runner.arch }}-buildx- | |
| - | |
| name: Build and export to Docker | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| load: true | |
| tags: | | |
| nukib/misp-modules:latest | |
| ghcr.io/nukib/misp-modules:latest | |
| cache-from: type=local,src=/tmp/.buildx-cache/amd64 | |
| cache-to: type=local,dest=/tmp/.buildx-cache-new/amd64,mode=max | |
| - | |
| name: Show image details | |
| run: | | |
| docker image inspect nukib/misp-modules:latest | |
| docker image history nukib/misp-modules:latest | |
| - | |
| name: Test | |
| run: | | |
| docker run --name misp-modules --rm -p 127.0.0.1:6666:6666 nukib/misp-modules:latest & | |
| sleep 5 # Wait until container is ready | |
| curl --fail http://localhost:6666/modules | jq | |
| docker stop misp-modules | |
| - | |
| # Temp fix | |
| # https://github.com/docker/build-push-action/issues/252 | |
| # https://github.com/moby/buildkit/issues/1896 | |
| name: Move cache | |
| run: | | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
| du -sh /tmp/.buildx-cache | |
| - | |
| name: Login to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| name: Login to DockerHub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: nukib | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - | |
| name: Push | |
| if: github.event_name != 'pull_request' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: | | |
| nukib/misp-modules:latest | |
| ghcr.io/nukib/misp-modules:latest | |