From dbfc19f87859991f3a2c24dd40b4dd1ba0854052 Mon Sep 17 00:00:00 2001 From: sudacode Date: Thu, 22 Aug 2024 22:47:48 -0700 Subject: [PATCH] add docker and compose file --- Dockerfile | 23 +++++++++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6fb47eb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use an official Python runtime as a parent image +FROM python:3.10-slim + +# Set environment variables for the MPV socket and server host/port +ENV MPV_SOCKET="/tmp/mpvsocket" \ + HOST_NAME="0.0.0.0" \ + PORT_NUMBER=8080 + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY server.py /app/server.py + +# Install any needed packages specified in requirements.txt +# If there are no external dependencies, you can skip this step +# RUN pip install --no-cache-dir -r requirements.txt + +# Make port 8080 available to the world outside this container +EXPOSE "${PORT_NUMBER}" + +# Run server.py when the container launches +CMD ["python3", "server.py", "--host", "${HOST_NAME}", "--port", "${PORT_NUMBER}", "--input-ipc-server", "${MPV_SOCKET}"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8f043c0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +--- +services: + mpv-youtube-queue-server: + build: . + container_name: mpv-youtube-queue-server + user: 1000:1000 + volumes: + - /tmp:/tmp + ports: + - 42069:8080 + env_file: .env + networks: + - mpv-youtube-queue-server + restart: unless-stopped +networks: + mpv-youtube-queue-server: + external: true