Skip to content

Commit

Permalink
feat: add dockerization support
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Dec 24, 2024
1 parent a9daeb3 commit 75c570b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist/
songs/
qrcode.png
.DS_Store
docker-compose.yml
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use bullseye over bookworm for better image size and ffmpeg compatibility
FROM python:3.12-slim-bullseye

# Install required packages
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install ffmpeg wireless-tools -y

WORKDIR /app

# Copy minimum required files into the image
COPY pyproject.toml ./
COPY pikaraoke ./pikaraoke
COPY docs ./docs

# Install pikaraoke
RUN pip install .

COPY docker/entrypoint.sh ./
RUN chmod +x entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]
14 changes: 14 additions & 0 deletions docker/docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
pikaraoke:
image: pikaraoke:latest
container_name: PiKaraoke
# Below Host network mode may work better on some systems and replace manual IP configuration. Does not work on OSX
# network_mode: host
environment:
EXTRA_ARGS: --url http://<YOUR_LAN_IP>:5555 # Replace with your LAN IP or DNS url, not necesary if using network_mode: host
volumes:
- </PATH/TO/LOCAL/SONGS/DIR>:/app/pikaraoke-songs # Replace with local dir. Insures your songs are persisted outside the container
restart: unless-stopped
ports:
- "5555:5555" # Forward the port for the web interface
- "5556:5556" # Forward the port for the ffmpeg video stream interface
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Run pikaraoke with necessary parameters
pikaraoke -d /app/pikaraoke-songs/ --headless $EXTRA_ARGS

# Keep the container running
tail -f /dev/null
14 changes: 7 additions & 7 deletions pikaraoke/lib/get_platform.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
import os
import platform
import re
Expand Down Expand Up @@ -35,13 +36,12 @@ def is_transpose_enabled():

def is_raspberry_pi():
try:
return (
(os.uname()[4][:3] == "arm" or os.uname()[4] == "aarch64")
and sys.platform != "darwin"
and not is_android()
)
except AttributeError:
return False
with io.open("/sys/firmware/devicetree/base/model", "r") as m:
if "raspberry pi" in m.read().lower():
return True
except Exception:
pass
return False


def is_android():
Expand Down

0 comments on commit 75c570b

Please sign in to comment.