mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 12:35:00 +00:00
114 lines
3.9 KiB
Text
114 lines
3.9 KiB
Text
FROM lukemathwalker/cargo-chef:0.1.68-rust-1.84.0-slim-bullseye AS chef
|
|
RUN apt update \
|
|
&& apt install -y git libssl-dev pkg-config\
|
|
&& apt clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
|
|
#
|
|
# Cache dependencies
|
|
#
|
|
|
|
FROM chef AS planner
|
|
COPY ./Cargo.lock ./Cargo.lock
|
|
COPY ./Cargo.toml ./Cargo.toml
|
|
COPY ./bindings/dart ./bindings/dart/
|
|
COPY ./bindings/go ./bindings/go/
|
|
COPY ./bindings/java ./bindings/java/
|
|
COPY ./bindings/javascript ./bindings/javascript/
|
|
COPY ./bindings/python ./bindings/python/
|
|
COPY ./bindings/rust ./bindings/rust/
|
|
COPY ./bindings/wasm ./bindings/wasm/
|
|
COPY ./cli ./cli/
|
|
COPY ./core ./core/
|
|
COPY ./extensions ./extensions/
|
|
COPY ./macros ./macros/
|
|
COPY ./simulator ./simulator/
|
|
COPY ./sqlite3 ./sqlite3/
|
|
COPY ./tests ./tests/
|
|
COPY ./stress ./stress/
|
|
COPY ./vendored ./vendored/
|
|
COPY ./testing/sqlite_test_ext ./testing/sqlite_test_ext/
|
|
RUN cargo chef prepare --bin turso_stress --recipe-path recipe.json
|
|
|
|
#
|
|
# Build the project.
|
|
#
|
|
|
|
FROM chef AS builder
|
|
|
|
ARG antithesis=true
|
|
|
|
RUN apt-get update && apt-get install -y pip && rm -rf /var/lib/apt/lists/*
|
|
RUN pip install maturin
|
|
|
|
# Source: https://antithesis.com/assets/instrumentation/libvoidstar.so
|
|
COPY stress/libvoidstar.so /opt/antithesis/libvoidstar.so
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
RUN cargo chef cook --bin turso_stress --release --recipe-path recipe.json
|
|
COPY --from=planner /app/Cargo.toml ./Cargo.toml
|
|
COPY --from=planner /app/cli ./cli/
|
|
COPY --from=planner /app/core ./core/
|
|
COPY --from=planner /app/extensions ./extensions/
|
|
COPY --from=planner /app/macros ./macros/
|
|
COPY --from=planner /app/simulator ./simulator/
|
|
COPY --from=planner /app/sqlite3 ./sqlite3/
|
|
COPY --from=planner /app/tests ./tests/
|
|
COPY --from=planner /app/stress ./stress/
|
|
COPY --from=planner /app/bindings/rust ./bindings/rust/
|
|
COPY --from=planner /app/bindings/dart ./bindings/dart/
|
|
COPY --from=planner /app/bindings/go ./bindings/go/
|
|
COPY --from=planner /app/bindings/javascript ./bindings/javascript/
|
|
COPY --from=planner /app/bindings/java ./bindings/java/
|
|
COPY --from=planner /app/bindings/python ./bindings/python/
|
|
COPY --from=planner /app/bindings/wasm ./bindings/wasm/
|
|
COPY --from=planner /app/core ./core/
|
|
COPY --from=planner /app/extensions ./extensions/
|
|
COPY --from=planner /app/macros ./macros/
|
|
COPY --from=planner /app/stress ./stress/
|
|
COPY --from=planner /app/vendored ./vendored/
|
|
COPY --from=planner /app/testing/sqlite_test_ext ./testing/sqlite_test_ext/
|
|
|
|
RUN if [ "$antithesis" = "true" ]; then \
|
|
cp /opt/antithesis/libvoidstar.so /usr/lib/libvoidstar.so && \
|
|
export RUSTFLAGS="-Ccodegen-units=1 -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Clink-args=-Wl,--build-id -L/usr/lib/ -lvoidstar" && \
|
|
cargo build --bin turso_stress --features antithesis --profile antithesis; \
|
|
else \
|
|
cargo build --bin turso_stress --release; \
|
|
fi
|
|
|
|
WORKDIR /app/bindings/python
|
|
RUN maturin build
|
|
|
|
#
|
|
# The final image.
|
|
#
|
|
|
|
FROM debian:bullseye-slim AS runtime
|
|
RUN apt-get update && apt-get install -y bash curl xz-utils python3 procps sqlite3 bc binutils pip && rm -rf /var/lib/apt/lists/*
|
|
RUN pip install antithesis
|
|
|
|
WORKDIR /app
|
|
EXPOSE 8080
|
|
COPY --from=builder /usr/lib/libvoidstar.so* /usr/lib/
|
|
COPY --from=builder /app/target/antithesis/turso_stress /bin/turso_stress
|
|
COPY --from=builder /app/target/antithesis/turso_stress /symbols
|
|
COPY stress/docker-entrypoint.sh /bin
|
|
RUN chmod +x /bin/docker-entrypoint.sh
|
|
|
|
COPY --from=builder /app/target/wheels/* /tmp
|
|
RUN pip install /tmp/*.whl
|
|
|
|
WORKDIR /app
|
|
COPY ./antithesis-tests/bank-test/*.py /opt/antithesis/test/v1/bank-test/
|
|
COPY ./antithesis-tests/stress-composer/*.py /opt/antithesis/test/v1/stress-composer/
|
|
COPY ./antithesis-tests/stress /opt/antithesis/test/v1/stress
|
|
RUN chmod 777 -R /opt/antithesis/test/v1
|
|
|
|
RUN mkdir /opt/antithesis/catalog
|
|
RUN ln -s /opt/antithesis/test/v1/bank-test/*.py /opt/antithesis/catalog
|
|
|
|
ENV RUST_BACKTRACE=1
|
|
|
|
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
|