mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 10:33:22 +01:00
124 lines
4.2 KiB
Docker
124 lines
4.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 rom-converto (optional ROM conversion/decryption/metadata tool).
|
|
# Pinned release; checksums are the upstream-published sha256 of the musl
|
|
# builds, which are fully static so they run on this glibc image. Bump the
|
|
# version and both sums together.
|
|
ARG TARGETARCH
|
|
RUN ROM_CONVERTO_VERSION=v0.21.0 \
|
|
&& case "${TARGETARCH}" in \
|
|
amd64) rc="linux-x64-musl"; sum="d6446fac50ca2dae2a3702351bc2c409a19f8a4f7a91ae838283ebf5f151e578" ;; \
|
|
arm64) rc="linux-arm64-musl"; sum="3ef3414ad425fb222f647ef0f3e74122077721a046eb07256c6d870b007b3c2e" ;; \
|
|
*) echo "unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
|
|
esac \
|
|
&& curl -fsSL -o "/tmp/rom-converto-cli-${rc}" \
|
|
"https://github.com/DevYukine/rom-converto/releases/download/${ROM_CONVERTO_VERSION}/rom-converto-cli-${rc}" \
|
|
&& echo "${sum} /tmp/rom-converto-cli-${rc}" | sha256sum -c --status \
|
|
&& install -m 0755 "/tmp/rom-converto-cli-${rc}" /usr/bin/rom-converto \
|
|
&& rm -f "/tmp/rom-converto-cli-${rc}"
|
|
|
|
# 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/
|
|
|
|
# Install Python
|
|
RUN uv python install 3.13
|
|
|
|
# Copy project files (including pyproject.toml and uv.lock)
|
|
COPY pyproject.toml uv.lock* .python-version /app/
|
|
|
|
# Install Python dependencies
|
|
RUN 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
|
|
ARG PYTHON_VERSION=3.13
|
|
# 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 \
|
|
&& mkdir -p "/app/.venv/lib/python${PYTHON_VERSION}/site-packages/sigil" \
|
|
&& cp ./sigil/*.py ./sigil/_sigil.*.so "/app/.venv/lib/python${PYTHON_VERSION}/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"]
|