-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (46 loc) · 2.05 KB
/
Dockerfile
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
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4
LABEL org.opencontainers.image.source=https://github.com/oviva-ag/konnektor-watchdog
ARG JAVA_PACKAGE=java-21-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
ARG OTEL_AGENT_VERSION=v2.6.0
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
# Install java and the run-java script
# Also set up permissions for user `1001`
RUN <<EOF
microdnf -y update
microdnf -y install ca-certificates ${JAVA_PACKAGE}
microdnf clean all
mkdir /deployments
chown 1001 /deployments
chmod "g+rwX" /deployments
chown 1001:root /deployments
curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh
chown 1001 /deployments/run-java.sh
chmod 540 /deployments/run-java.sh
curl "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/${OTEL_AGENT_VERSION}/opentelemetry-javaagent.jar" -o opentelemetry-javaagent.jar -L
echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
echo "securerandom.strongAlgorithms=NativePRNGNonBlocking:SUN,DRBG:SUN" >> /etc/alternatives/jre/conf/security/java.security
EOF
# Configure OpenTelemetry
ENV OTEL_JAVAAGENT_DEBUG=false
ENV OTEL_JAVAAGENT_ENABLED=false
ENV OTEL_METRICS_EXPORTER=none
ENV OTEL_LOGS_EXPORTER=none
ENV OTEL_TRACES_EXPORTER=otlp
ENV OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
## Allowlist instrumented components for faster startup
ENV OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED=false
ENV OTEL_INSTRUMENTATION_JAVA_HTTP_CLIENT_ENABLED=true
ENV OTEL_INSTRUMENTATION_JAXRS_ENABLED=false
ENV OTEL_INSTRUMENTATION_UNDERTOW_ENABLED=true
# Java dependencies
COPY --chown=1001 target/lib /deployments/
# application
COPY --chown=1001 target/konnektor-watchdog.jar /deployments/
WORKDIR /deployments
# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-javaagent:/opentelemetry-javaagent.jar"
ENV JAVA_MAIN_CLASS=com.oviva.konnektor.watchdog.Main
USER 1001
EXPOSE 8080
ENTRYPOINT [ "/deployments/run-java.sh" ]