Added building a Docker image for the course #2
Workflow file for this run
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 publish Docker image for the project | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
Docker: | |
if: github.repository == 'antmicro/dl-in-iot-course' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel previous run | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build . --tag ghcr.io/${{ github.repository }} | |
- name: Login to registry | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Push image to registry | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
run: docker push ghcr.io/${{ github.repository }} |