Build & Push to Container Registry #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: Docker CI | |
| run-name: Build & Push to Container Registry | |
| on: | |
| push: | |
| branches: | |
| main | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.6, 3.8, 3.12] | |
| include: | |
| - python-version: 3.6 | |
| image-version: slim-buster | |
| - python-version: 3.8 | |
| image-version: slim-buster | |
| - python-version: 3.12 | |
| image-version: slim-bookworm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| logout: true | |
| - name: build and push to registry | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| build-args: | | |
| PYTHON_VERSION=${{ matrix.python-version }} | |
| IMAGE_VERSION=${{ matrix.image-version }} | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/python:${{ matrix.python-version }}-ihr |