Added Dockerfile

This commit is contained in:
Martin Asprusten 2025-04-20 16:48:49 +02:00
parent 564e449e33
commit da99a1bdd5
2 changed files with 27 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM python:3.13-slim-bookworm AS build
WORKDIR /santa
RUN mkdir -p /santa/WebServer/static
COPY setup-server.sh /santa/setup-server.sh
RUN apt-get update && apt-get install -y curl
RUN /santa/setup-server.sh --download-only
COPY requirements.txt /santa/requirements.txt
COPY src/setup.py /santa/src/setup.py
COPY src/SantaExchange/ /santa/src/SantaExchange/
COPY WebServer/__init__.py WebServer/server.py /santa/WebServer/
COPY WebServer/templates/ /santa/WebServer/templates/
COPY WebServer/static/exchange_client.py WebServer/static/exchange_worker.js WebServer/static/style.css /santa/WebServer/static/
RUN pip install -r /santa/requirements.txt
RUN /santa/setup-server.sh
FROM python:3.13-slim-bookworm
RUN pip install flask flask-socketio gunicorn eventlet
COPY --from=build /santa/WebServer /WebServer
WORKDIR /WebServer
EXPOSE 8000
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "4", "--bind", "0.0.0.0:8000", "server:app"]

View File

@ -17,6 +17,10 @@ if ! test -f ./WebServer/static/socket.io.min.js; then
fi fi
echo "Socket.io is installed" echo "Socket.io is installed"
if [[ "$1" == "--download-only" ]]; then
exit 0
fi
echo "Building wheel file of SantaExchange package" echo "Building wheel file of SantaExchange package"
cd src/ cd src/
python setup.py bdist_wheel python setup.py bdist_wheel