-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.13 KB
/
publish_image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
name: "Publish Docker Image"
permissions:
packages: write
contents: read
attestations: write
id-token: write
env:
OAK_MODULE_DIR: "code/oak-d-lite-module"
REGISTRY: "ghcr.io"
IMAGE_NAME: "${{ github.repository }}:latest"
on:
push: # Only run after merge to main, when these files change
branches: [master, main]
paths:
- "${{ env.OAK_MODULE_DIR }}/Dockerfile"
- "${{ env.OAK_MODULE_DIR }}/requirements.txt"
- "${{ env.OAK_MODULE_DIR }}/vision_webserver.py"
- ".github/workflows/publish_image.yaml" # This file
workflow_dispatch: true
jobs:
build:
name: Publish Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log into GHCR
run: docker login ${{ env.REGISTRY }} -u ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
run: |
pushd $OAK_MODULE_DIR
docker build -t "${{ env.IMAGE_NAME }}" .
popd
- name: Push Docker Image
run: docker push ${{ env.IMAGE_NAME }}
# EOF