Added OpenTelemetry Java Agent JAR to container image (#391)
Closes #387
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
FROM maven:3.8-openjdk-17-slim as build-hapi
|
||||
WORKDIR /tmp/hapi-fhir-jpaserver-starter
|
||||
|
||||
ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.15.0
|
||||
RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar
|
||||
|
||||
COPY pom.xml .
|
||||
COPY server.xml .
|
||||
RUN mvn -ntp dependency:go-offline
|
||||
@@ -29,15 +32,19 @@ USER 1001
|
||||
COPY --chown=1001:1001 catalina.properties /opt/bitnami/tomcat/conf/catalina.properties
|
||||
COPY --chown=1001:1001 server.xml /opt/bitnami/tomcat/conf/server.xml
|
||||
COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /opt/bitnami/tomcat/webapps_default/ROOT.war
|
||||
COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app
|
||||
|
||||
ENV ALLOW_EMPTY_PASSWORD=yes
|
||||
|
||||
########### distroless brings focus on security and runs on plain spring boot - this is the default image
|
||||
FROM gcr.io/distroless/java17:nonroot as default
|
||||
COPY --chown=nonroot:nonroot --from=build-distroless /app /app
|
||||
# 65532 is the nonroot user's uid
|
||||
# used here instead of the name to allow Kubernetes to easily detect that the container
|
||||
# is running as a non-root (uid != 0) user.
|
||||
USER 65532:65532
|
||||
WORKDIR /app
|
||||
|
||||
COPY --chown=nonroot:nonroot --from=build-distroless /app /app
|
||||
COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app
|
||||
|
||||
CMD ["/app/main.war"]
|
||||
|
||||
Reference in New Issue
Block a user