Skip to content

Commit

Permalink
Merge pull request #10 from Patrick762/docker-image
Browse files Browse the repository at this point in the history
added docker image for server
  • Loading branch information
Patrick762 authored Dec 21, 2024
2 parents 0283903 + 481c29b commit 2a38a2d
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -21,7 +35,6 @@ pipwin install cairocffi
```

### Limitations
- Slow icon updates on Raspberry Pi Zero
- No `doubleTap` event

### Installation on Linux / Raspberry Pi
Expand Down

0 comments on commit 2a38a2d

Please sign in to comment.