diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..b561d5e --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,50 @@ +name: Docker + +on: + release: + types: [published] + workflow_dispatch: + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b43bdc0..6555e23 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -36,4 +36,4 @@ jobs: uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ - password: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file + password: ${{ secrets.PYPI_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..79a7202 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.9.18-bookworm + +# Get dependencies +RUN apt update +RUN apt install -y libudev-dev libusb-1.0-0-dev libhidapi-libusb0 libjpeg-dev zlib1g-dev libopenjp2-7 libtiff5-dev libgtk-3-dev +RUN apt clean +RUN rm -rf /var/lib/apt/lists/* + +COPY . /streamdeckapi +WORKDIR /streamdeckapi + +# Install the pip package +RUN pip install --no-cache-dir . + +EXPOSE 6153 + +# Run the server +CMD [ "streamdeckapi-server" ] diff --git a/README.md b/README.md index 75d59e2..e42bc02 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,21 @@ Stream Deck API Library for Home Assistant Stream Deck Integration Only compatible with separate [Stream Deck Plugin](https://github.com/Patrick762/streamdeckapi-plugin) or the bundled server. -## Server +## Server inside docker container +The docker image allows you to use the streamdeckapi server inside a docker container. + +### Usage +```shell +docker run -v /dev/hidraw7:/dev/hidraw7 -p 6153:6153 --privileged ghcr.io/patrick762/streamdeckapi +``` + +**Note:** You have to change `hidraw7` to the path of your Stream Deck. You can find this path by using `lshid` (https://pypi.org/project/lshid/). + +## Limitations +- No zeroconf discovery +- No `doubleTap` event + +## Server without docker This library also contains a server to use the streamdeck with Linux or without the official Stream Deck Software. For this to work, the following software is required: @@ -21,7 +35,6 @@ pipwin install cairocffi ``` ### Limitations -- Slow icon updates on Raspberry Pi Zero - No `doubleTap` event ### Installation on Linux / Raspberry Pi