-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.patched
62 lines (57 loc) · 1.67 KB
/
Dockerfile.patched
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
# build the rocksdb deps
FROM ubuntu:24.04 AS build-rocksdb
RUN mkdir /home/java && \
apt-get update && \
apt-get install -y \
build-essential \
libgflags-dev \
libsnappy-dev \
zlib1g-dev \
libbz2-dev \
liblz4-dev \
libzstd-dev \
git \
cmake \
curl \
default-jdk-headless \
maven
WORKDIR /home/java
RUN git clone --no-checkout https://github.com/facebook/rocksdb.git
RUN cd rocksdb && \
git checkout v9.5.2
COPY rocksdb/* patches/
RUN cd rocksdb && \
for patch in ../patches/*.patch; do \
patch -p1 < "$patch"; \
done
RUN --mount=type=cache,target=/root/.m2 \
cd rocksdb && \
JAVA_HOME=/usr/lib/jvm/default-java make -j $(nproc) rocksdbjavastatic
RUN ln -s /home/java/rocksdb/java/target/rocksdbjni-*.jar /home/java/rocksdbjni.jar
# build the java archive + fetch the deps
FROM ubuntu:24.04 AS build-java
RUN apt-get update && \
apt-get install -y \
curl \
default-jdk-headless \
maven
COPY src /home/java/src
COPY pom.xml /home/java/
WORKDIR /home/java
RUN curl -fL -o dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
RUN --mount=type=cache,target=/root/.m2 \
mvn clean install && \
ln -s target/test_rocksdb*.jar test_rocksdb.jar
# final image
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y default-jre-headless && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/java
COPY --from=build-java /home/java/*.jar /home/java/
COPY --from=build-rocksdb /home/java/*.jar /home/java/
CMD java \
-javaagent:dd-java-agent.jar \
-classpath "rocksdbjni.jar:test_rocksdb.jar" \
test.App