CI: login to dockerhub before every build&push #12
Workflow file for this run
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: CI-production-publishing-slips-images | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| - 'alya/immune/make_dockerfile_compatible_with_rpi' | |
| - '!develop' | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-22.04 | |
| # 2 hours timeout | |
| timeout-minutes: 120 | |
| outputs: | |
| slips_version: ${{ steps.get_version.outputs.slips_version }} | |
| steps: | |
| - name: Get slips version | |
| id: get_version | |
| run: | | |
| ver=$(curl -s https://raw.githubusercontent.com/stratosphereips/StratosphereLinuxIPS/develop/VERSION) | |
| echo "slips_version=$ver" >> $GITHUB_OUTPUT | |
| # Set up Docker Buildx with docker-container driver is required | |
| # at the moment to be able to use a subdirectory with Git context | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| publish_images: | |
| needs: setup | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| image_type: | |
| - name: slips | |
| dockerfile: ./docker/Dockerfile | |
| - name: slips_light | |
| dockerfile: ./docker/light/Dockerfile | |
| steps: | |
| # clone slips and checkout branch | |
| # By default it checks out only one commit | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: 'master' | |
| # Fetch all history for all tags and branches | |
| fetch-depth: 0 | |
| # submodules are needed for local and global p2p | |
| submodules: true | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: stratosphereips | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push ${{ matrix.image_type.name }} image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| allow: network.host | |
| context: ./ | |
| file: ${{ matrix.image_type.dockerfile }} | |
| tags: | | |
| stratosphereips/${{ matrix.image_type.name }}:testing_${{ needs.setup.outputs.slips_version }} | |
| push: true |