Merge pull request #10 from Patrick762/docker-image

added docker image for server
This commit is contained in:
Patrick762
2024-12-21 21:23:59 +01:00
committed by GitHub
4 changed files with 84 additions and 3 deletions

50
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -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 <account>/<repo>
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 }}

18
Dockerfile Normal file
View File

@@ -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" ]

View File

@@ -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