Bot-Man-Toe/pyserver/Containerfile

26 lines
635 B
Docker

FROM python:3.10-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache gcc musl-dev python3-dev
COPY requirements-pyserver.txt .
# Create wheels for faster installation
RUN pip wheel --no-cache-dir --wheel-dir /wheels -r requirements-pyserver.txt
FROM python:3.10-alpine
WORKDIR /app
# Install from pre-built wheels
COPY --from=builder /wheels /wheels
COPY requirements-pyserver.txt .
RUN pip install --no-cache-dir --no-index --find-links=/wheels \
-r requirements-pyserver.txt && rm -rf /wheels
# Install PyServer code
COPY pyserver/ pyserver/
COPY server.py .
CMD ["python", "server.py"]