-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.26 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (31 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM python:3.12-slim
# Install pygame system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy source code, data files, and SVG sprite assets
COPY src/ src/
COPY tests/ tests/
COPY data/ data/
COPY docs/ docs/
# Copy and install dependencies (layer caching)
COPY pyproject.toml ./
RUN pip install --no-cache-dir setuptools wheel && \
pip install --no-cache-dir --no-build-isolation ".[dev]" || \
pip install --no-cache-dir pygame numpy pydantic defusedxml pytest pytest-cov pytest-mock pytest-randomly pytest-timeout freezegun scipy hypothesis Pillow
# Fallback retains as install safety net; pyproject.toml [dev] is complete.
# Set environment for headless CI
ENV SDL_VIDEODRIVER=dummy
ENV SDL_AUDIODRIVER=dummy
ENV PYTHONPATH=/app/src
# Create non-root user for security (P1 fix from v0.6.7 assessment)
RUN groupadd -r pycc2 && useradd -r -g pycc2 -d /app -s /sbin/nologin pycc2 && \
chown -R pycc2:pycc2 /app
USER pycc2
# Default: run unit tests only (e2e tests require display renderer, see CI workflow)
CMD ["python", "-m", "pytest", "tests/unit/", "-q", "--tb=short"]