cpu only #26
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 & Publish Docker Image | |
on: | |
pull_request: | |
branches: [ docker ] | |
paths: | |
- 'docker/Dockerfile' | |
- 'docker/requirements.txt' | |
- 'docker/docker-compose.yml' | |
- '.github/workflows/docker-publish.yml' | |
push: | |
branches: [ docker ] | |
paths: | |
- 'docker/Dockerfile' | |
- 'docker/requirements.txt' | |
- 'docker/docker-compose.yml' | |
- '.github/workflows/docker-publish.yml' | |
# ─────────────── global env ────────────────────────────────────────────────── | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: deeptrackai/deep-learning-crash-course # change once here | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write # needed to push to GHCR | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 # multi-arch emulation | |
- uses: docker/setup-buildx-action@v3 # Buildx driver with cache support | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build (and push on main branch) | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./docker | |
file: Dockerfile # adjust if your Dockerfile moves | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name == 'push' }} # PRs build but don’t publish | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} |