diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e30bbdd --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/requirements.txt b/requirements.txt index 2e4af92..92cde3a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,2 @@ -asarPy==1.0.1 pygame==2.5.2 pygbag==0.9.2 -PyYAML==6.0.2 -websockets==15.0.1 diff --git a/tetri5/online.py b/tetri5/online.py index 07fedfa..4f2f9b0 100644 --- a/tetri5/online.py +++ b/tetri5/online.py @@ -1,6 +1,6 @@ import sys sys.path.append("__pypackages__/3.12/lib/") -import websockets +import websockets # non-native package import asyncio import json