Build and push Docker Images #29
This file contains 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 and push Docker Images | |
env: | |
REGISTRY: quay.io | |
OWNER: ${{ github.repository_owner }} | |
REPOSITORY_NAME: workshop-notebook | |
JUPYTERHUB_VERSION: 4.1.4 | |
PUSH_TO_REGISTRY: true | |
on: | |
schedule: | |
# Weekly, at 06:00 on Monday UTC (our notebook docker stacks @ https://github.com/aihpi/workshop-jupyterhub are built at 05:00) | |
- cron: "0 6 * * 1" | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency | |
concurrency: | |
# Only cancel in-progress jobs or runs for the current workflow - matches against branch & tags | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-test-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo ⚡️ | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image 🛠 | |
run: docker build --rm --force-rm --tag ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.REPOSITORY_NAME }}:pytorch-cuda12-ollama-local-rag-hub-${{ env.JUPYTERHUB_VERSION }} . --build-arg REGISTRY=${{ env.REGISTRY }} --build-arg OWNER=${{ env.OWNER }} --build-arg JUPYTERHUB_VERSION=${{ env.JUPYTERHUB_VERSION }} | |
env: | |
DOCKER_BUILDKIT: 1 | |
# Full logs for CI build | |
BUILDKIT_PROGRESS: plain | |
shell: bash | |
- name: Log in to Registry 🔑 | |
if: env.PUSH_TO_REGISTRY == 'true' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Push Images to Registry 📤 | |
if: env.PUSH_TO_REGISTRY == 'true' | |
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.REPOSITORY_NAME }} | |
shell: bash |