change to gunicorn to serve app
This commit is contained in:
parent
6b19d96658
commit
dc696b51b3
17
Dockerfile
17
Dockerfile
@ -2,20 +2,14 @@
|
|||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
|
|
||||||
# Set environment variables for the MPV socket and server host/port
|
# Set environment variables for the MPV socket and server host/port
|
||||||
ENV MPV_SOCKET="/tmp/mpvsocket" \
|
ENV LISTEN_ADDRESS="0.0.0.0" \
|
||||||
HOST_NAME="0.0.0.0" \
|
LISTEN_PORT=8080
|
||||||
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
|
# Set the working directory in the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the current directory contents into the container at /app
|
# Copy the current directory contents into the container at /app
|
||||||
COPY server.py /app/server.py
|
COPY server.py requirements.txt /app/
|
||||||
|
|
||||||
# Install any needed packages specified in requirements.txt
|
# Install any needed packages specified in requirements.txt
|
||||||
# If there are no external dependencies, you can skip this step
|
# If there are no external dependencies, you can skip this step
|
||||||
@ -24,7 +18,8 @@ COPY server.py /app/server.py
|
|||||||
# Make port 8080 available to the world outside this container
|
# Make port 8080 available to the world outside this container
|
||||||
EXPOSE "${PORT_NUMBER}"
|
EXPOSE "${PORT_NUMBER}"
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir Flask mysql-connector-python
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Run server.py when the container launches
|
# Run server.py when the container launches
|
||||||
CMD ["python3", "server.py", "--host", "${HOST_NAME}", "--port", "${PORT_NUMBER}", "--input-ipc-server", "${MPV_SOCKET}"]
|
# CMD ["python3", "server.py", "--host", "${LISTEN_ADDRESS}", "--port", "${LISTEN_PORT}", "--input-ipc-server", "${MPV_SOCKET}"]
|
||||||
|
CMD gunicorn --bind "${LISTEN_ADDRESS}":"${LISTEN_PORT}" server:app
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
blinker==1.8.2
|
blinker==1.8.2
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
Flask==3.0.3
|
Flask==3.0.3
|
||||||
|
gunicorn==23.0.0
|
||||||
itsdangerous==2.2.0
|
itsdangerous==2.2.0
|
||||||
Jinja2==3.1.4
|
Jinja2==3.1.4
|
||||||
MarkupSafe==2.1.5
|
MarkupSafe==2.1.5
|
||||||
mysql-connector-python==9.0.0
|
mysql-connector-python==9.0.0
|
||||||
|
packaging==24.1
|
||||||
Werkzeug==3.0.4
|
Werkzeug==3.0.4
|
||||||
|
Loading…
Reference in New Issue
Block a user