add docker and compose file

This commit is contained in:
sudacode 2024-08-22 22:47:48 -07:00
parent 87c8c5c786
commit dbfc19f878
2 changed files with 40 additions and 0 deletions

23
Dockerfile Normal file
View File

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

17
docker-compose.yml Normal file
View File

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