Files
romm/Dockerfile
Georges-Antoine Assi a3aecdf045 chore(python): restore the C accelerators lost on 3.14
The runtime moved to 3.14 but the pinned versions did not, so packages
without cp314 wheels silently resolved to their pure-Python universal
wheels. Bump each to the first release that ships cp314 wheels, all
within the existing pyproject specs:

- SQLAlchemy 2.0.41 -> 2.0.52 (cyextension, and greenlet is back so
  sqlalchemy.ext.asyncio is functional rather than merely importable)
- multidict, propcache, frozenlist (aiohttp/yarl accelerators)
- wrapt 1.17.2 -> 1.17.3 (OpenTelemetry instrumentation proxies)
- coverage 7.9.2 -> 7.16.0 (CTracer, and CI runs the suite under --cov)
- mysql-connector-python 9.3.0 -> 9.7.0 (C extension protocol)
- debugpy 1.8.14 -> 1.8.21 (pydevd accelerators)
- pyinstrument 5.0.3 -> 5.1.3 (no longer compiled from sdist on every
  `uv sync --all-extras`, which broke the no-toolchain dev setup)
- anyio 4.9.0 -> 4.14.2, dropping a PEP 765 SyntaxWarning printed on
  every process start

Run pytest and the migrations workflow when the runtime or the lock
changes: nothing in the 3.14 bump lives under `backend/`, so neither
workflow triggered on it. `e2e.yml` already listed those paths.

Make `.python-version` the single home for the version: `uv python
install` and `actions/setup-python` both read it. In the dev Dockerfile
that also fixes the interpreter layer not being invalidated when the pin
changes, and the sigil install now derives site-packages from the venv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 21:48:52 -04:00

105 lines
3.2 KiB
Docker

# trunk-ignore-all(trivy)
# trunk-ignore-all(checkov)
FROM ubuntu:22.04
# Prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
make \
cmake \
gcc \
g++ \
libmariadb3 \
libmariadb-dev \
libpq-dev \
libffi-dev \
musl-dev \
curl \
ca-certificates \
libmagic-dev \
7zip \
libarchive-tools \
tzdata \
libbz2-dev \
libssl-dev \
libreadline-dev \
libsqlite3-dev \
zlib1g-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install nvm
ENV NVM_DIR="/root/.nvm"
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install 24.16.0 \
&& nvm use 24.16.0 \
&& nvm alias default 24.16.0
ENV PATH="$NVM_DIR/versions/node/v24.16.0/bin:$PATH"
# Build and install RAHasher (optional for RA hashes)
RUN git clone --recursive --branch 1.8.3 --depth 1 https://github.com/RetroAchievements/RALibretro.git /tmp/RALibretro
WORKDIR /tmp/RALibretro
RUN make HAVE_CHD=1 -f ./Makefile.RAHasher \
&& cp ./bin64/RAHasher /usr/bin/RAHasher
RUN rm -rf /tmp/RALibretro
# Install frontend dependencies
COPY frontend/package.json /app/frontend/
WORKDIR /app/frontend
RUN npm install
# Install backend Node helpers (server-side ROM patching)
COPY backend/utils/rom_patcher/package.json /app/backend/utils/rom_patcher/
WORKDIR /app/backend/utils/rom_patcher
RUN npm install
# Set working directory
WORKDIR /app
# Install uv for the non-root user
COPY --from=ghcr.io/astral-sh/uv:0.11.2 /uv /uvx /usr/local/bin/
# Copy project files (including pyproject.toml and uv.lock)
COPY pyproject.toml uv.lock* .python-version /app/
# Install Python (pinned by .python-version) and the project dependencies
RUN uv python install \
&& uv sync --all-extras
ENV PATH="/app/.venv/bin:${PATH}"
# Build and install sigil (optional, for title ID extraction)
# Placed after `uv sync` because the extension is compiled with the venv's
# Python so the ABI matches. Keep the pin in sync with docker/Dockerfile.
ARG SIGIL_VERSION=9665f03c04d0f547ed38dd5e5e31916c1da5f2e9
# One layer, so the clone and the cmake tree never reach the image.
# trunk-ignore(hadolint/DL3003)
RUN git clone --filter=blob:none https://github.com/rommforge/argosy-sigil.git /tmp/argosy-sigil \
&& cd /tmp/argosy-sigil \
&& git checkout "${SIGIL_VERSION}" \
&& git submodule update --init --recursive \
&& cmake -B ./build-python -S . -DSIGIL_BUILD_CLI=OFF -DSIGIL_BUILD_TESTS=OFF \
&& cmake --build ./build-python --target sigil \
&& uv pip install --python /app/.venv/bin/python cffi setuptools \
&& cd ./bindings/python \
&& /app/.venv/bin/python build_sigil.py \
&& SITE_PACKAGES="$(/app/.venv/bin/python -c 'import site; print(site.getsitepackages()[0])')" \
&& mkdir -p "${SITE_PACKAGES}/sigil" \
&& cp ./sigil/*.py ./sigil/_sigil.*.so "${SITE_PACKAGES}/sigil/" \
&& rm -rf /tmp/argosy-sigil
WORKDIR /app
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]