Skip to content

Commit a55e45b

Browse files
author
Kurt Stam
committed
adding arm64v8 build
1 parent 14e31db commit a55e45b

File tree

127 files changed

+16154
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+16154
-20
lines changed

blocks/qemu-lib-arm64v8/commands.dck

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COPY qemu-aarch64-static /usr/bin/
Binary file not shown.

images.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ fish-pepper:
44
- base
55
- version
66
- type
7-
name: "fabric8/java"
7+
- arch
8+
name: "project31/java"
89
build: "1.6.1"
910

1011
# Used for escaping in 'agent-bond-opts' where the same delimiters are used
@@ -24,7 +25,7 @@ config:
2425
7: 7.201.2.6.16-r0
2526
8: 8.201.08-r1
2627
centos:
27-
from: "centos:7.6.1810"
28+
from: centos:7.6.1810
2829
createUser: true
2930
user: "jboss"
3031
version: "7"
@@ -33,13 +34,6 @@ config:
3334
7: 1.7.0.201-2.6.16.1.el7_6
3435
8: 1.8.0.201.b09-2.el7_6
3536
11: 11.0.2.7-0.el7_6
36-
jboss:
37-
deprecated: true
38-
from: "jboss/base-jdk"
39-
user: "jboss"
40-
# Use the major version
41-
tagFromMajorVersion: true
42-
description: "JBoss with OpenJDK"
4337
version:
4438
openjdk7:
4539
version: "1.7.0"
@@ -68,3 +62,9 @@ config:
6862
- [ "jboss" ]
6963
jdk:
7064
description: "Java Development Kit (JDK)"
65+
66+
arch:
67+
amd64:
68+
dockerOrg: "p31amd64"
69+
arm64v8:
70+
dockerOrg: "p31arm64v8"

images/alpine/openjdk7/jdk/Dockerfile renamed to images/alpine/openjdk7/jdk/amd64/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM alpine:3.9
1+
FROM p31amd64/alpine:3.9
2+
23

34
USER root
45

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM p31arm64v8/alpine:3.9
2+
COPY qemu-aarch64-static /usr/bin/
3+
4+
5+
USER root
6+
7+
RUN mkdir -p /deployments
8+
9+
# JAVA_APP_DIR is used by run-java.sh for finding the binaries
10+
ENV JAVA_APP_DIR=/deployments \
11+
JAVA_MAJOR_VERSION=7
12+
13+
14+
# /dev/urandom is used as random source, which is perfectly safe
15+
# according to http://www.2uo.de/myths-about-urandom/
16+
RUN apk add --update \
17+
curl \
18+
openjdk7=7.201.2.6.16-r0 \
19+
&& rm /var/cache/apk/* \
20+
&& echo "securerandom.source=file:/dev/urandom" >> /usr/lib/jvm/default-jvm/jre/lib/security/java.security
21+
22+
# Agent bond including Jolokia and jmx_exporter
23+
ADD agent-bond-opts /opt/run-java-options
24+
RUN mkdir -p /opt/agent-bond \
25+
&& curl http://central.maven.org/maven2/io/fabric8/agent-bond-agent/1.2.0/agent-bond-agent-1.2.0.jar \
26+
-o /opt/agent-bond/agent-bond.jar \
27+
&& chmod 444 /opt/agent-bond/agent-bond.jar \
28+
&& chmod 755 /opt/run-java-options
29+
ADD jmx_exporter_config.yml /opt/agent-bond/
30+
EXPOSE 8778 9779
31+
32+
# Add run script as /deployments/run-java.sh and make it executable
33+
COPY run-java.sh /deployments/
34+
RUN chmod 755 /deployments/run-java.sh
35+
36+
37+
38+
39+
CMD [ "/deployments/run-java.sh" ]
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
## Fabric8 Java Base Image OpenJDK 7 (JDK)
2+
3+
4+
5+
This image is based on Alpine and provides OpenJDK 7 (JDK)
6+
7+
It includes:
8+
9+
10+
* An [Agent Bond](https://github.com/fabric8io/agent-bond) agent with [Jolokia](http://www.jolokia.org) and Prometheus' [jmx_exporter](https://github.com/prometheus/jmx_exporter). The agent is installed as `/opt/agent-bond/agent-bond.jar`. See below for configuration options.
11+
12+
13+
* A startup script [`/deployments/run-java.sh`](#startup-script-run-javash) for starting up Java applications.
14+
15+
### Agent Bond
16+
17+
In order to enable Jolokia for your application you should use this image as a base image (via `FROM`) and use the output of `agent-bond-opts` in your startup scripts to include it in for the Java startup options.
18+
19+
For example, the following snippet can be added to a script starting up your Java application
20+
21+
# ...
22+
export JAVA_OPTIONS="$JAVA_OPTIONS $(agent-bond-opts)"
23+
# .... use JAVA_OPTIONS when starting your app, e.g. as Tomcat does
24+
25+
The following versions and defaults are used:
26+
27+
* [Jolokia](http://www.jolokia.org) : version **1.6.0** and port **8778**
28+
* [jmx_exporter](https://github.com/prometheus/jmx_exporter): version **0.3.1** and port **9779**
29+
30+
You can influence the behaviour of `agent-bond-opts` by setting various environment variables:
31+
32+
### Agent-Bond Options
33+
34+
Agent bond itself can be influenced with the following environment variables:
35+
36+
* **AB_OFF** : If set disables activation of agent-bond (i.e. echos an empty value). By default, agent-bond is enabled.
37+
* **AB_ENABLED** : Comma separated list of sub-agents enabled. Currently allowed values are `jolokia` and `jmx_exporter`.
38+
By default both are enabled.
39+
40+
41+
#### Jolokia configuration
42+
43+
* **AB_JOLOKIA_CONFIG** : If set uses this file (including path) as Jolokia JVM agent properties (as described
44+
in Jolokia's [reference manual](http://www.jolokia.org/reference/html/agents.html#agents-jvm)).
45+
By default this is `/opt/jolokia/jolokia.properties`.
46+
* **AB_JOLOKIA_HOST** : Host address to bind to (Default: `0.0.0.0`)
47+
* **AB_JOLOKIA_PORT** : Port to use (Default: `8778`)
48+
* **AB_JOLOKIA_USER** : User for authentication. By default authentication is switched off.
49+
* **AB_JOLOKIA_HTTPS** : Switch on secure communication with https. By default self signed server certificates are generated
50+
if no `serverCert` configuration is given in `AB_JOLOKIA_OPTS`
51+
* **AB_JOLOKIA_PASSWORD** : Password for authentication. By default authentication is switched off.
52+
* **AB_JOLOKIA_ID** : Agent ID to use (`$HOSTNAME` by default, which is the container id)
53+
* **AB_JOLOKIA_OPTS** : Additional options to be appended to the agent opts. They should be given in the format
54+
"key=value,key=value,..."
55+
56+
Some options for integration in various environments:
57+
58+
* **AB_JOLOKIA_AUTH_OPENSHIFT** : Switch on client authentication for OpenShift TLS communication. The value of this
59+
parameter can be a relative distinguished name which must be contained in a presented client certificate. Enabling this
60+
parameter will automatically switch Jolokia into https communication mode. The default CA cert is set to
61+
`/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`
62+
63+
#### jmx_exporter configuration
64+
65+
* **AB_JMX_EXPORTER_OPTS** : Configuration to use for `jmx_exporter` (in the format `<port>:<path to config>`)
66+
* **AB_JMX_EXPORTER_PORT** : Port to use for the JMX Exporter. Default: `9779`
67+
* **AB_JMX_EXPORTER_CONFIG** : Path to configuration to use for `jmx_exporter`: Default: `/opt/agent-bond/jmx_exporter_config.json`
68+
69+
70+
71+
### Startup Script run-java.sh
72+
73+
The default command for this image is [/deployments/run-java.sh](https://github.com/fabric8io/run-java-sh). Its purpose it to fire up Java applications which are provided as fat-jars, including all dependencies or more classical from a main class, where the classpath is build up from all jars within a directory.
74+
75+
For these images the variable **JAVA_APP_DIR** has the default value `/deployments`
76+
77+
78+
### run-java.sh
79+
80+
This general purpose startup script is optimized for running Java application from within containers. It is called like
81+
82+
```
83+
./run-java.sh <sub-command> <options>
84+
```
85+
`run-java.sh` knows two sub-commands:
86+
87+
* `options` to print out JVM option which can be used for own invocation of Java apps (like Maven or Tomcat). It respects container constraints and includes all magic which is used by this script
88+
* `run` executes a Java application as described below. This is also the default command so you can skip adding this command.
89+
90+
### Running a Java application
91+
92+
When no subcommand is given (or when you provide the default subcommand `run`), then by default this scripts starts up Java application.
93+
94+
The startup process is configured mostly via environment variables:
95+
96+
* **JAVA_APP_DIR** the directory where the application resides. All paths in your application are relative to this directory. By default it is the same directory where this startup script resides.
97+
* **JAVA_LIB_DIR** directory holding the Java jar files as well an optional `classpath` file which holds the classpath. Either as a single line classpath (colon separated) or with jar files listed line-by-line. If not set **JAVA_LIB_DIR** is the same as **JAVA_APP_DIR**.
98+
* **JAVA_OPTIONS** options to add when calling `java`
99+
* **JAVA_MAJOR_VERSION** a number >= 7. If the version is set then only options suitable for this version are used. When set to 7 options known only to Java > 8 will be removed. For versions >= 10 no explicit memory limit is calculated since Java >= 10 has support for container limits.
100+
* **JAVA_MAX_MEM_RATIO** is used when no `-Xmx` option is given in `JAVA_OPTIONS`. This is used to calculate a default maximal Heap Memory based on a containers restriction. If used in a Docker container without any memory constraints for the container then this option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio of the container available memory as set here. The default is `25` when the maximum amount of memory available to the container is below 300M, `50` otherwise, which means in that case that 50% of the available memory is used as an upper boundary. You can skip this mechanism by setting this value to 0 in which case no `-Xmx` option is added.
101+
* **JAVA_INIT_MEM_RATIO** is used when no `-Xms` option is given in `JAVA_OPTIONS`. This is used to calculate a default initial Heap Memory based on a containers restriction. If used in a Docker container without any memory constraints for the container then this option has no effect. If there is a memory constraint then `-Xms` is set to a ratio of the container available memory as set here. By default this value is not set.
102+
* **JAVA_MAX_CORE** restrict manually the number of cores available which is used for calculating certain defaults like the number of garbage collector threads. If set to 0 no base JVM tuning based on the number of cores is performed.
103+
* **JAVA_DIAGNOSTICS** set this to get some diagnostics information to standard out when things are happening
104+
* **JAVA_MAIN_CLASS** A main class to use as argument for `java`. When this environment variable is given, all jar files in `$JAVA_APP_DIR` are added to the classpath as well as `$JAVA_LIB_DIR`.
105+
* **JAVA_APP_JAR** A jar file with an appropriate manifest so that it can be started with `java -jar` if no `$JAVA_MAIN_CLASS` is set. In all cases this jar file is added to the classpath, too.
106+
* **JAVA_APP_NAME** Name to use for the process
107+
* **JAVA_CLASSPATH** the classpath to use. If not given, the startup script checks for a file `${JAVA_APP_DIR}/classpath` and use its content literally as classpath. If this file doesn't exists all jars in the app dir are added (`classes:${JAVA_APP_DIR}/*`).
108+
* **JAVA_DEBUG** If set remote debugging will be switched on
109+
* **JAVA_DEBUG_SUSPEND** If set enables suspend mode in remote debugging
110+
* **JAVA_DEBUG_PORT** Port used for remote debugging. Default: 5005
111+
* **HTTP_PROXY** The URL of the proxy server that translates into the `http.proxyHost` and `http.proxyPort` system properties.
112+
* **HTTPS_PROXY** The URL of the proxy server that translates into the `https.proxyHost` and `https.proxyPort` system properties.
113+
* **no_proxy**, **NO_PROXY** The list of hosts that should be reached directly, bypassing the proxy, that translates into the `http.nonProxyHosts` system property.
114+
115+
If neither `$JAVA_APP_JAR` nor `$JAVA_MAIN_CLASS` is given, `$JAVA_APP_DIR` is checked for a single JAR file which is taken as `$JAVA_APP_JAR`. If no or more then one jar file is found, an error is thrown.
116+
117+
The classpath is build up with the following parts:
118+
119+
* If `$JAVA_CLASSPATH` is set, this classpath is taken.
120+
* The current directory (".") is added first.
121+
* If the current directory is not the same as `$JAVA_APP_DIR`, `$JAVA_APP_DIR` is added.
122+
* If `$JAVA_MAIN_CLASS` is set, then
123+
- A `$JAVA_APP_JAR` is added if set
124+
- If a file `$JAVA_APP_DIR/classpath` exists, its content is appended to the classpath. This file
125+
can be either a single line with the jar files colon separated or a multi-line file where each line
126+
holds the path of the jar file relative to `$JAVA_LIB_DIR` (which by default is the `$JAVA_APP_DIR`)
127+
- If this file is not set, a `${JAVA_APP_DIR}/*` is added which effectively adds all
128+
jars in this directory in alphabetical order.
129+
130+
These variables can be also set in a shell config file `run-env.sh`, which will be sourced by the startup script. This file can be located in the directory where the startup script is located and in `${JAVA_APP_DIR}`, whereas environment variables in the latter override the ones in `run-env.sh` from the script directory.
131+
132+
This startup script also checks for a command `run-java-options`. If existent it will be called and the output is added to the environment variable `$JAVA_OPTIONS`.
133+
134+
The startup script also exposes some environment variables describing container limits which can be used by applications:
135+
136+
* **CONTAINER_CORE_LIMIT** a calculated core limit as described in https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
137+
* **CONTAINER_MAX_MEMORY** memory limit given to the container
138+
139+
Any arguments given to the script are given through directly as argument to the Java application.
140+
141+
Example:
142+
143+
```
144+
# Set the application directory directly
145+
export JAVA_APP_DIR=/deployments
146+
# Set -Xmx based on container constraints
147+
export JAVA_MAX_MEM_RATIO=40
148+
# Start the jar in JAVA_APP_DIR with the given arguments
149+
./run-java.sh --user maxmorlock --password secret
150+
```
151+
152+
### Options
153+
154+
This script can also be used to calculate reasonable, best-practice options for starting Java apps in general. For example, when running Maven in a container it makes sense to respect container Memory constraints.
155+
156+
The subcommand `options` can be used to print options to standard output so that is can be easily used to feed it to another, Java based application.
157+
158+
When no extra arguments are given, all defaults will be used, which can be influenced with the environment variables described above.
159+
160+
You can select specific sets of options by providing additional arguments:
161+
162+
* `--debug` : Java debug options if `JAVA_DEBUG` is set
163+
* `--memory` : Memory settings based on the environment variables given
164+
* `--proxy` : Evaluate proxy environments variables
165+
* `--cpu` : Tuning when the number of cores is limited
166+
* `--gc` : GC tuning parameters
167+
* `--jit` : JIT options
168+
* `--diagnostics` : Print diagnostics options when `JAVA_DIAGNOSTICS` is set
169+
* `--java-default` : Same as `--memory --jit --diagnostic --cpu --gc`
170+
171+
Example:
172+
173+
```
174+
# Call Maven with the proper memory settings when running in an container
175+
export MAVEN_OPTS="$(run-java.sh options --memory)"
176+
mvn clean install
177+
```
178+
179+
180+
### Versions:
181+
182+
* Base-Image: **Alpine 3.9**
183+
* Java: **OpenJDK 7 1.7.0** (Java Development Kit (JDK))
184+
* Agent-Bond: **1.2.0** (Jolokia 1.6.0, jmx_exporter 0.3.1)
Binary file not shown.

images/alpine/openjdk7/jre/Dockerfile renamed to images/alpine/openjdk7/jre/amd64/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM alpine:3.9
1+
FROM p31amd64/alpine:3.9
2+
23

34
USER root
45

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM p31arm64v8/alpine:3.9
2+
COPY qemu-aarch64-static /usr/bin/
3+
4+
5+
USER root
6+
7+
RUN mkdir -p /deployments
8+
9+
# JAVA_APP_DIR is used by run-java.sh for finding the binaries
10+
ENV JAVA_APP_DIR=/deployments \
11+
JAVA_MAJOR_VERSION=7
12+
13+
14+
# /dev/urandom is used as random source, which is perfectly safe
15+
# according to http://www.2uo.de/myths-about-urandom/
16+
RUN apk add --update \
17+
curl \
18+
openjdk7-jre-base=7.201.2.6.16-r0 \
19+
&& rm /var/cache/apk/* \
20+
&& echo "securerandom.source=file:/dev/urandom" >> /usr/lib/jvm/default-jvm/jre/lib/security/java.security
21+
22+
# Agent bond including Jolokia and jmx_exporter
23+
ADD agent-bond-opts /opt/run-java-options
24+
RUN mkdir -p /opt/agent-bond \
25+
&& curl http://central.maven.org/maven2/io/fabric8/agent-bond-agent/1.2.0/agent-bond-agent-1.2.0.jar \
26+
-o /opt/agent-bond/agent-bond.jar \
27+
&& chmod 444 /opt/agent-bond/agent-bond.jar \
28+
&& chmod 755 /opt/run-java-options
29+
ADD jmx_exporter_config.yml /opt/agent-bond/
30+
EXPOSE 8778 9779
31+
32+
# Add run script as /deployments/run-java.sh and make it executable
33+
COPY run-java.sh /deployments/
34+
RUN chmod 755 /deployments/run-java.sh
35+
36+
37+
38+
39+
CMD [ "/deployments/run-java.sh" ]

0 commit comments

Comments
 (0)