forked from rabbitmq/rabbitmq-perf-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-alpine
56 lines (43 loc) · 1.93 KB
/
Dockerfile-alpine
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
ARG alpine_version="3.13.5"
FROM alpine:$alpine_version as builder
ARG perf_test_binary="target/rabbitmq-perf-test-*-bin.tar.gz"
RUN set -eux; \
\
apk add --no-cache --virtual .build-deps \
ca-certificates \
wget \
gnupg \
jq
ARG JAVA_VERSION="11"
RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ; then echo "ARM"; ARCH="arm"; else echo "x86"; ARCH="x86"; fi \
&& wget "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/?jdk_version=$JAVA_VERSION&ext=tar.gz&os=linux&arch=$ARCH&hw_bitness=64&release_status=ga" -O jdk-info.json
RUN wget --progress=bar:force:noscroll -O "jdk.tar.gz" $(cat jdk-info.json | jq --raw-output .url)
RUN echo "$(cat jdk-info.json | jq --raw-output .sha256_hash) *jdk.tar.gz" | sha256sum -cw -
RUN set -eux; \
JAVA_PATH="/usr/lib/jdk-$JAVA_VERSION"; \
mkdir $JAVA_PATH && \
tar --extract --file jdk.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,jdk.crypto.cryptoki; \
/jre/bin/java -version
ENV PERF_TEST_HOME="/perf_test"
ENV PERF_TEST_PATH="/usr/local/src/perf-test"
COPY $perf_test_binary $PERF_TEST_PATH.tar.gz
RUN set -eux; \
\
# /usr/local/src doesn't exist in Alpine by default
mkdir -p /usr/local/src; \
\
mkdir -p "$PERF_TEST_HOME"; \
tar --extract --file "$PERF_TEST_PATH.tar.gz" --directory "$PERF_TEST_HOME" --strip-components 1
FROM alpine:$alpine_version
RUN apk add --no-cache bash
ENV JAVA_HOME=/usr/lib/jvm/java-1.11-zulu/jre
RUN mkdir -p $JAVA_HOME
COPY --from=builder /jre /usr/lib/jvm/java-1.11-zulu/jre/
RUN ln -svT $JAVA_HOME/bin/java /usr/local/bin/java
RUN mkdir -p /perf_test
WORKDIR /perf_test
COPY --from=builder /perf_test ./
RUN bin/runjava com.rabbitmq.perf.PerfTest --version
RUN bin/runjava com.rabbitmq.perf.PerfTest --help
ENTRYPOINT ["bin/runjava", "com.rabbitmq.perf.PerfTest"]