28 lines
628 B
Docker
28 lines
628 B
Docker
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"]
|