Files
trailofbits-buttercup/program-model/Dockerfile
T
Riccardo Schirone e0b898a6b4 program-model: introduce codequery (#178)
* program-model/tree-sitter: refactor classes

* program-model/tree-sitter: change how paths are considered

This allows to parse also code in oss-fuzz (e.g. injected fuzz targets
not in upstream project)

* common: change name format for challenge commit

* program-model/codequery: make it persistent and nice

* program-model: disable janus & co for now

* patcher: make use of codequery instead of just tree-sitter

* program-model: add integration tests for codequery

* program-model/codequery: add support for different languages

* patcher: install codequery in patcher's container

* ci: fix codequery install

* program-model: ensure cqdb storage in /crs_scratch

* program-model: ensure the cqdb storage is available only at the end
2025-03-10 14:11:07 +01:00

52 lines
1.9 KiB
Docker

ARG BASE_IMAGE=ubuntu:20.04@sha256:4a45212e9518f35983a976eead0de5eecc555a2f047134e9dd2cfc589076a00d
FROM $BASE_IMAGE AS base
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.10 curl
RUN curl -fsSL https://get.docker.com | sh
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.5.20 /uv /uvx /bin/
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PYTHON=python3.10
WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=common/uv.lock,target=/common/uv.lock \
--mount=type=bind,source=common/pyproject.toml,target=/common/pyproject.toml \
--mount=type=bind,source=common/README.md,target=/common/README.md \
--mount=type=bind,source=program-model/uv.lock,target=/app/uv.lock \
--mount=type=bind,source=program-model/pyproject.toml,target=/app/pyproject.toml \
--mount=type=bind,source=program-model/README.md,target=/app/README.md \
cd /app && uv sync --frozen --no-install-project --no-editable
COPY ./common /common
COPY ./program-model /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable
FROM base AS runtime
WORKDIR /app
# NOTE: Commenting this out for now as we switch to using codequery until Kythe is ready
#
# COPY ./program-model/scripts /app/scripts
# RUN mkdir -p /app/scripts/gzs/kythe/
# COPY --from=ghcr.io/aixcc-finals/buttercup-kythe:main /kythe-v0.0.67.tar.gz /app/scripts/gzs/
# RUN tar xvzf /app/scripts/gzs/kythe-v0.0.67.tar.gz -C /app/scripts/gzs/kythe/ --strip-components=1
# RUN rm /app/scripts/gzs/kythe-v0.0.67.tar.gz
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y codequery && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder --chown=app:app /app/.venv /app/.venv
ENV PATH=/app/.venv/bin:$PATH