Kyle Yasuda
bebeedc0ae
- update to Flask - add history db for watch history tracking - update service file Co-authored-by: ksyasuda <ksyasuda@umich.edu> Reviewed-on: #1
31 lines
1001 B
Docker
31 lines
1001 B
Docker
# 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 \
|
|
MYSQL_HOST="localhost" \
|
|
MYSQL_USER="mpvuser" \
|
|
MYSQL_PASSWORD="SecretPassword" \
|
|
MYSQL_DATABASE="mpv" \
|
|
MYSQL_PORT=3306
|
|
|
|
# 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 pip3 install --no-cache-dir Flask mysql-connector-python
|
|
|
|
# Run server.py when the container launches
|
|
CMD ["python3", "server.py", "--host", "${HOST_NAME}", "--port", "${PORT_NUMBER}", "--input-ipc-server", "${MPV_SOCKET}"]
|