forked from rabbitmq/rabbitmq-perf-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.dev
64 lines (50 loc) · 2.1 KB
/
Dockerfile.dev
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
FROM ubuntu:18.04 as builder
RUN set -eux ; \
apt-get update ; \
apt-get install --yes --no-install-recommends \
ca-certificates \
make \
bash \
unzip \
wget
# change the JAVA_URL variable below as well
ENV JAVA_VERSION="11.0.2"
# https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.2%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.2_9.tar.gz.sha256.txt
ENV JAVA_SHA256="d02089d834f7702ac1a9776d8d0d13ee174d0656cf036c6b68b9ffb71a6f610e"
ENV JAVA_URL="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-${JAVA_VERSION}%2B9/OpenJDK11U-jdk_x64_linux_hotspot_${JAVA_VERSION}_9.tar.gz"
ENV JAVA_PATH="/jdk-${JAVA_VERSION}"
ENV JAVA_HOME="${JAVA_PATH}"
RUN set -eux ; \
wget --progress dot:giga --output-document "$JAVA_PATH.tar.gz" "$JAVA_URL" ; \
echo "$JAVA_SHA256 *$JAVA_PATH.tar.gz" | sha256sum --check --strict - ; \
mkdir -p "$JAVA_PATH" ; \
tar --extract --file "$JAVA_PATH.tar.gz" --directory "$JAVA_PATH" --strip-components 1 ; \
$JAVA_PATH/bin/jlink --compress=2 --output /jre --add-modules java.base,java.management,java.xml,java.naming,java.sql ; \
/jre/bin/java -version
RUN mkdir -p /perf_test_dev
WORKDIR /perf_test_dev
# If we COPY ., the layer will be rebuilt whenever a file has changed in the project directory
# We only care about the files used in the binary
COPY .mvn .mvn/
COPY bin bin/
COPY html html/
COPY images images/
COPY scripts scripts/
COPY src src/
COPY Makefile mvnw mvnw.cmd pom.xml ./
# Keep this as a self-contained step
# If any of the following steps fail, the Maven deps will be cached
RUN make binary
RUN set -eux ; \
unzip target/rabbitmq-perf-test-*-SNAPSHOT-bin.zip ; \
mv rabbitmq-perf-test-*-SNAPSHOT /perf_test ; \
cd /perf_test ; \
bin/runjava com.rabbitmq.perf.PerfTest --help
FROM ubuntu:18.04
ENV JAVA_HOME=/jre
COPY --from=builder /jre $JAVA_HOME/
RUN ln -svT $JAVA_HOME/bin/java /usr/local/bin/java
COPY --from=builder /perf_test /perf_test
WORKDIR /perf_test
RUN bin/runjava com.rabbitmq.perf.PerfTest --help
ENTRYPOINT ["bin/runjava", "com.rabbitmq.perf.PerfTest"]