feat: add a Dockerfile for deploy
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal 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"]
|
||||||
@@ -1,5 +1,2 @@
|
|||||||
asarPy==1.0.1
|
|
||||||
pygame==2.5.2
|
pygame==2.5.2
|
||||||
pygbag==0.9.2
|
pygbag==0.9.2
|
||||||
PyYAML==6.0.2
|
|
||||||
websockets==15.0.1
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append("__pypackages__/3.12/lib/")
|
sys.path.append("__pypackages__/3.12/lib/")
|
||||||
import websockets
|
import websockets # non-native package
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
|||||||
Reference in New Issue
Block a user