-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.alpine
122 lines (102 loc) · 6.11 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
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
# joyent/cosbench-manta
# We use the Azul OpenJDK because it is a well tested and supported build.
FROM azul/zulu-openjdk-alpine:8
MAINTAINER Elijah Zupancic <elijah.zupancic@joyent.com>
ENV JAVA_HOME=/usr/lib/jvm/zulu8.30.0.1-jdk8.0.172-linux_x64
ENV _JAVA_OPTIONS=-Dcom.twmacinta.util.MD5.NATIVE_LIB_FILE=/opt/cosbench/lib/arch/linux_amd64/MD5.so
ENV COSBENCH_VERSION 0.4.2.c4
ENV COSBENCH_CHECKSUM abe837ffce3d6f094816103573433f5358c0b27ce56f414a60dceef985750397
ENV CONTAINERPILOT_VER 2.7.8
ENV CONTAINERPILOT file:///etc/containerpilot.json
ENV OSGI_CONSOLE_PORT_DRIVER 18089
ENV OSGI_CONSOLE_PORT_CONTROLLER 19089
ENV MODE unknown
# Users can supply a path to the JAR and checksum through build args, we default to pulling down the
# latest release from Github
ENV COSBENCH_MANTA_VERSION 1.1.1
ARG COSBENCH_MANTA_PATH=https://github.com/joyent/cosbench-manta/releases/download/cosbench-manta-${COSBENCH_MANTA_VERSION}/cosbench-manta-${COSBENCH_MANTA_VERSION}.jar
ARG COSBENCH_MANTA_CHECKSUM=e40354da3d156fdc5792c3cbde84dcc9c48edb40b05e78a98d958926c1b0120f
ADD $COSBENCH_MANTA_PATH /tmp/
# Metadata for Docker containers: http://label-schema.org/
LABEL org.label-schema.name="COSBench $COSBENCH_VERSION with Manta SDK Support" \
org.label-schema.description="COSBench with Manta Support" \
org.label-schema.url="https://github.com/joyent/cosbench-manta" \
org.label-schema.vcs-url="org.label-schema.vcs-ref" \
org.label-schema.vendor="Joyent" \
org.label-schema.schema-version="1.0"
# Installed tools:
# ==============================================================================
# openssh-client: for ssh-keygen to generate key fingerprints
# curl: for downloading binaries
# ca-certificates: for downloading via https
# vim: for debugging cosbench (omitted in slim version)
# unzip: for installing binaries
# htop: for analyzing cosbench performance (omitted in slim version)
# netcat-traditional: for starting cosbench OSGI services (netcat-openbsd in alpine)
# dc: for calculating performance settings (bc in alpine)
# libnss3: Native crypto tools for improving JVM crypo performance (nss in alpine)
# procps: Adds unix ps command
# strace: Adds strace for debugging system calls
# cosbench-manta: Cosbench adaptor for Manta
# shadow: for user management (alpine-only)
# ==============================================================================
RUN apk add --no-cache openssh-client curl ca-certificates unzip netcat-openbsd bc less nss procps strace shadow && \
echo Installing cryptographic extensions && \
curl --retry 6 -Ls "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip" > /tmp/ZuluJCEPolicies.zip && \
echo '8021a28b8cac41b44f1421fd210a0a0822fcaf88d62d2e70a35b2ff628a8675a /tmp/ZuluJCEPolicies.zip' | sha256sum -c && \
unzip -o -j /tmp/ZuluJCEPolicies.zip ZuluJCEPolicies/local_policy.jar ZuluJCEPolicies/US_export_policy.jar -d $JAVA_HOME/jre/lib/security && \
rm /tmp/ZuluJCEPolicies.zip && \
echo Downloading and install Cosbench && \
curl --retry 6 -Ls "https://github.com/intel-cloud/cosbench/releases/download/v${COSBENCH_VERSION}/${COSBENCH_VERSION}.zip" > /tmp/cosbench.zip && \
echo "${COSBENCH_CHECKSUM} /tmp/cosbench.zip" | sha256sum -c && \
unzip -q /tmp/cosbench.zip -d /opt/ && \
mv "/opt/${COSBENCH_VERSION}" /opt/cosbench && \
rm /tmp/cosbench.zip && \
echo Installing Consul && \
export CONSUL_VERSION=0.9.2 && \
export CONSUL_CHECKSUM=0a2921fc7ca7e4702ef659996476310879e50aeeecb5a205adfdbe7bd8524013 && \
curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" && \
echo "${CONSUL_CHECKSUM} /tmp/consul.zip" | sha256sum -c && \
unzip /tmp/consul -d /usr/local/bin && \
rm /tmp/consul.zip && \
mkdir /config && \
echo Installing consul-template && \
export CONSUL_TEMPLATE_VERSION=0.19.2 && \
export CONSUL_TEMPLATE_CHECKSUM=c4bf073081a99030f45a446a11b8e9f8a4b56270b096d90b51e48f6e4416ffcc && \
curl --retry 7 --fail -Lso /tmp/consul-template.zip "https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip" && \
echo "${CONSUL_TEMPLATE_CHECKSUM} /tmp/consul-template.zip" | sha256sum -c && \
unzip /tmp/consul-template.zip -d /usr/local/bin && \
rm /tmp/consul-template.zip && \
mkdir -p /etc/consul && mkdir -p /var/lib/consul && \
export CONTAINERPILOT_CHECKSUM=09158be44c3e887244581d4d019748df9fcfa93c && \
curl -Lso /tmp/containerpilot.tar.gz \
"https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VER}/containerpilot-${CONTAINERPILOT_VER}.tar.gz" && \
echo "${CONTAINERPILOT_CHECKSUM} /tmp/containerpilot.tar.gz" | sha1sum -c && \
tar zxf /tmp/containerpilot.tar.gz -C /usr/local/bin && \
rm /tmp/containerpilot.tar.gz && \
mkdir -p /opt/cosbench-manta && \
echo "${COSBENCH_MANTA_CHECKSUM} /tmp/$(basename $COSBENCH_MANTA_PATH)" | sha256sum -c && \
mv "/tmp/$(basename $COSBENCH_MANTA_PATH)" /opt/cosbench/osgi/plugins/cosbench-manta.jar && \
echo Creating Tomcat user to run COSBench process && \
groupadd -g 120 tomcat && \
useradd -g 120 -u 120 -c 'Tomcat User' -d /opt/cosbench -r tomcat && \
mkdir /opt/cosbench/.ssh && \
chown -R tomcat:tomcat /opt/cosbench && \
chown -R tomcat:tomcat /var/lib/consul && \
echo Making cosbench helper scripts executable && \
find /opt/cosbench -maxdepth 1 -type f -name \*.sh -exec chmod +x '{}' \;
COPY docker_build/usr /usr
RUN chmod +x /usr/local/bin/proclimit
COPY docker_build/etc /etc
# Adding sample Manta configuration, init files and customized configuration
COPY docker_build/opt/cosbench /opt/cosbench
# Adding container pilot config
COPY docker_build/etc /etc
# Run the container using the tomcat user by default
USER tomcat
# COSBench driver port
EXPOSE 18088
# COSBench controller port
EXPOSE 19088
WORKDIR /opt/cosbench
CMD [ "/usr/local/bin/containerpilot", "/opt/cosbench/autopilot-start-tomcat.sh" ]