From aee6434ea552c942e6f0e599d4976ece2fca8a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cuhel?= <79118988+HonzaCuhel@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:18:43 +0200 Subject: [PATCH] Add ghcr publishing workflow (#86) --- .github/workflows/publish_image.yaml | 43 ++++++++++++++++++++++++++++ README.md | 6 ++-- 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish_image.yaml diff --git a/.github/workflows/publish_image.yaml b/.github/workflows/publish_image.yaml new file mode 100644 index 0000000..187289f --- /dev/null +++ b/.github/workflows/publish_image.yaml @@ -0,0 +1,43 @@ +name: Publishing a docker image + +on: + push: + branches: ['cli'] + +env: + NAME: luxonis/tools_cli + +jobs: + ghcr-publish: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get tools-cli version + id: commit + run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Docker login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish latest + run: | + docker build -t $NAME:latest . + docker tag $NAME:latest ghcr.io/$NAME:latest + docker push ghcr.io/$NAME:latest + + - name: Publish tagged + run: | + VERSION=${{ steps.commit.outputs.sha }} + docker tag $NAME:latest ghcr.io/$NAME:$VERSION + docker push ghcr.io/$NAME:$VERSION diff --git a/README.md b/README.md index 10d368a..7ce5aa9 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ cd tools ```bash # Building Docker image -docker build -t tools-cli . +docker build -t tools_cli . # Running the image -docker run -v "${PWD}/shared_with_container:/app/shared_with_container" tools-cli shared_with_container/models/yolov8n-seg.pt --imgsz "416" +docker run -v "${PWD}/shared_with_container:/app/shared_with_container" tools_cli shared_with_container/models/yolov8n-seg.pt --imgsz "416" ``` ### Using Docker compose @@ -32,7 +32,7 @@ docker run -v "${PWD}/shared_with_container:/app/shared_with_container" tools-cl # Building Docker image docker compose build # Running the image -docker compose run tools-cli shared_with_container/models/yolov6nr4.pt +docker compose run tools_cli shared_with_container/models/yolov6nr4.pt ``` ### Using Python package