-
Notifications
You must be signed in to change notification settings - Fork 830
Expand file tree
/
Copy pathDockerfile.antithesis
More file actions
149 lines (129 loc) · 6.09 KB
/
Dockerfile.antithesis
File metadata and controls
149 lines (129 loc) · 6.09 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
FROM lukemathwalker/cargo-chef:0.1.72-rust-1.88.0-slim-bookworm 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/dotnet ./bindings/dotnet/
COPY ./bindings/java ./bindings/java/
COPY ./bindings/javascript ./bindings/javascript/
COPY ./bindings/python ./bindings/python/
COPY ./bindings/rust ./bindings/rust/
COPY ./cli ./cli/
COPY ./core ./core/
COPY ./extensions ./extensions/
COPY ./macros ./macros/
COPY ./parser ./parser/
COPY ./perf/encryption ./perf/encryption
COPY ./perf/throughput/rusqlite ./perf/throughput/rusqlite/
COPY ./perf/throughput/turso ./perf/throughput/turso/
COPY ./perf/memory ./perf/memory/
COPY ./testing/simulator ./testing/simulator/
COPY ./sql_generation ./sql_generation
COPY ./sqlite3 ./sqlite3/
COPY ./testing/stress ./testing/stress/
COPY ./sync ./sync/
COPY ./testing/sqlite_test_ext ./testing/sqlite_test_ext/
COPY ./testing/unreliable-libc ./testing/unreliable-libc/
COPY ./tests ./tests/
COPY ./testing/sqltests ./testing/sqltests/
COPY ./testing/concurrent-simulator ./testing/concurrent-simulator/
COPY ./testing/differential-oracle ./testing/differential-oracle/
COPY ./sdk-kit ./sdk-kit/
COPY ./sdk-kit-macros ./sdk-kit-macros/
COPY ./tools ./tools/
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 --break-system-packages maturin
# Antithesis instrumentation library
ADD https://antithesis.com/assets/instrumentation/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 /app/Cargo.lock ./
COPY --from=planner /app/bindings/dotnet ./bindings/dotnet/
COPY --from=planner /app/bindings/java ./bindings/java/
COPY --from=planner /app/bindings/javascript ./bindings/javascript/
COPY --from=planner /app/bindings/python ./bindings/python/
COPY --from=planner /app/bindings/rust ./bindings/rust/
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/parser ./parser/
COPY --from=planner /app/perf/encryption ./perf/encryption
COPY --from=planner /app/perf/throughput/rusqlite ./perf/throughput/rusqlite/
COPY --from=planner /app/perf/throughput/turso ./perf/throughput/turso/
COPY --from=planner /app/perf/memory ./perf/memory/
COPY --from=planner /app/testing/simulator ./testing/simulator/
COPY --from=planner /app/sql_generation ./sql_generation
COPY --from=planner /app/sqlite3 ./sqlite3/
COPY --from=planner /app/testing/stress ./testing/stress/
COPY --from=planner /app/sync ./sync/
COPY --from=planner /app/testing/sqlite_test_ext ./testing/sqlite_test_ext/
COPY --from=planner /app/testing/unreliable-libc ./testing/unreliable-libc/
COPY --from=planner /app/tests ./tests/
COPY --from=planner /app/testing/sqltests ./testing/sqltests/
COPY --from=planner /app/testing/concurrent-simulator ./testing/concurrent-simulator/
COPY --from=planner /app/testing/differential-oracle ./testing/differential-oracle
COPY --from=planner /app/sdk-kit ./sdk-kit/
COPY --from=planner /app/sdk-kit-macros ./sdk-kit-macros/
COPY --from=planner /app/tools ./tools/
# Remove cdylib and staticlib from this line: `crate-type = ["lib", "cdylib", "staticlib"]`
# This is because somehow we lose llvm sanitizer coverage if the crate is not just a lib.
RUN for f in sdk-kit/Cargo.toml sync/sdk-kit/Cargo.toml; do \
grep -qF 'crate-type = ["lib", "cdylib", "staticlib"]' "$f" \
|| { echo "ERROR: expected crate-type not found in $f"; exit 1; }; \
done \
&& sed -i 's/crate-type = \["lib", "cdylib", "staticlib"\]/crate-type = ["lib"]/' \
sdk-kit/Cargo.toml sync/sdk-kit/Cargo.toml
RUN if [ "$antithesis" = "true" ]; then \
cp /opt/antithesis/libvoidstar.so /usr/lib/libvoidstar.so && \
export RUSTFLAGS="--cfg=tokio_unstable --cfg=antithesis -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 --profile antithesis; \
else \
cargo build --bin turso_stress --release; \
fi
WORKDIR /app/bindings/python
RUN maturin build
WORKDIR /app/testing/unreliable-libc
RUN make
#
# The final image.
#
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y bash curl xz-utils python3 procps sqlite3 bc binutils pip rust-gdb && rm -rf /var/lib/apt/lists/*
RUN pip install --break-system-packages antithesis
WORKDIR /app
EXPOSE 8080
COPY --from=builder /usr/lib/libvoidstar.so* /usr/lib/
COPY --from=builder /app/testing/unreliable-libc/unreliable-libc.so /usr/lib/
COPY --from=builder /app/target/antithesis/turso_stress /bin/turso_stress
COPY --from=builder /app/target/antithesis/turso_stress /symbols
COPY testing/stress/docker-entrypoint.sh /bin
RUN chmod +x /bin/docker-entrypoint.sh
COPY --from=builder /app/target/wheels/* /tmp
RUN pip install --break-system-packages /tmp/*.whl
WORKDIR /app
COPY ./testing/antithesis/bank-test/*.py /opt/antithesis/test/v1/bank-test/
COPY ./testing/antithesis/stress-composer/*.py /opt/antithesis/test/v1/stress-composer/
COPY ./testing/antithesis/stress /opt/antithesis/test/v1/stress
COPY ./testing/antithesis/stress-io_uring /opt/antithesis/test/v1/stress-io_uring
COPY ./testing/antithesis/stress-mvcc /opt/antithesis/test/v1/stress-mvcc
COPY ./testing/antithesis/stress-io_uring-mvcc /opt/antithesis/test/v1/stress-io_uring-mvcc
COPY ./testing/antithesis/stress-unreliable /opt/antithesis/test/v1/stress-unreliable
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"]