feat: add a Dockerfile for deploy

This commit is contained in:
2025-07-28 17:44:58 -04:00
parent 9fe278675d
commit e155985496
3 changed files with 28 additions and 4 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM python:3.12-slim
# Install build dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Set working directory
WORKDIR /app
# Copy project files
COPY . .
# Install PyYAML and websockets into __pypackages__/3.12/lib
RUN mkdir -p __pypackages__/3.12/lib && \
PYTHONPATH=__pypackages__/3.12/lib \
pip install --no-cache-dir --target=__pypackages__/3.12/lib \
PyYAML==6.0.2 websockets==15.0.1
# Build the web version
RUN pygbag --build main.py
# Expose the desired port
EXPOSE 3010
# Serve the build output
WORKDIR /app/build/web
CMD ["python", "-m", "http.server", "3010"]

View File

@@ -1,5 +1,2 @@
asarPy==1.0.1
pygame==2.5.2
pygbag==0.9.2
PyYAML==6.0.2
websockets==15.0.1

View File

@@ -1,6 +1,6 @@
import sys
sys.path.append("__pypackages__/3.12/lib/")
import websockets
import websockets # non-native package
import asyncio
import json