Also push to docker hub #23
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: "Build docker container image" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| paths: | |
| - 'oxybox/src/**' | |
| - '.github/workflows/BUILD_AND_DEPLOY.yml' | |
| pull_request: | |
| branches: | |
| - develop | |
| - main | |
| paths: | |
| - 'oxybox/src/**' | |
| - '.github/workflows/BUILD_AND_DEPLOY.yml' | |
| jobs: | |
| # validate that the docker image is built. | |
| # will only scan for vulnerabilities and push to acr on push events | |
| docker-build: | |
| name: Build docker image | |
| runs-on: baseflow-runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| name: Checkout | |
| - name: Get project version from Cargo.toml | |
| id: get_version | |
| run: | | |
| version=$(grep '^version' oxybox/Cargo.toml | head -n 1 | cut -d '"' -f2) | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - uses: Baseflow/github-actions/docker@main | |
| name: Build docker image | |
| with: | |
| username: ${{ secrets.BASEFLOW_ACR_USERNAME }} | |
| password: ${{ secrets.BASEFLOW_ACR_PASSWORD }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| vulnerability_scan: ${{ github.event_name != 'pull_request' }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| context: ./oxybox | |
| - uses: Baseflow/github-actions/docker@main | |
| if: github.ref == 'refs/heads/main' | |
| name: Build docker image to docker hub | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| registry: hub.docker.io | |
| push: ${{ github.event_name != 'pull_request' }} | |
| vulnerability_scan: ${{ github.event_name != 'pull_request' }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| context: ./oxybox | |
| - uses: Baseflow/github-actions/docker@main | |
| if: github.ref == 'refs/heads/main' | |
| name: Build docker image to docker hub | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| registry: hub.docker.io | |
| push: ${{ github.event_name != 'pull_request' }} | |
| vulnerability_scan: ${{ github.event_name != 'pull_request' }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| tag: latest | |
| context: ./oxybox |