Description
Describe the bug
Help!!!
My dockerfile
Stage 1: Dependency identification (18-alpine)
FROM amazoncorretto:18-alpine as deps
Identify dependencies
COPY ./app/build/libs/app--SNAPSHOT.jar /app/app.jar
RUN mkdir /app/unpacked &&
cd /app/unpacked &&
unzip ../app.jar &&
cd .. &&
$JAVA_HOME/bin/jdeps
--ignore-missing-deps
--print-module-deps
-q
--recursive
--multi-release 17
--class-path="./unpacked/BOOT-INF/lib/"
--module-path="./unpacked/BOOT-INF/lib/*"
./app.jar > /deps.info
Stage 2: Build JRE (17-alpine)
FROM amazoncorretto:17-alpine as openjdk
Required for strip-debug to work
RUN apk add --no-cache binutils
Copy module dependencies info
COPY --from=deps /deps.info /deps.info
RUN echo "cat deps.info
,jdk.crypto.ec,jdk.zipfs" > /deps.info
Build small JRE image
RUN $JAVA_HOME/bin/jlink
--verbose
--add-modules $(cat deps.info)
--strip-debug
--no-man-pages
--no-header-files
--compress=2
--output /customjre
Stage 3: Main application image (alpine)
FROM alpine:latest
Set Java Home and PATH
ENV JAVA_HOME=/jre
ENV PATH="${JAVA_HOME}/bin:${PATH}"
Copy JRE from the previous image
COPY --from=openjdk /customjre $JAVA_HOME
Add application user
ARG APPLICATION_USER=flc
RUN adduser --no-create-home -u 1000 -D $APPLICATION_USER
Prepare app directory
RUN mkdir /app &&
chown -R $APPLICATION_USER /app
USER 1000
Copy the application JAR
COPY --chown=1000:1000 ./app/build/libs/app-*-SNAPSHOT.jar /app/app.jar
Copy the Elastic APM agent and OpenTelemetry Java agent
COPY --chown=1000:1000 ./elastic-apm-agent-1.35.0.jar /app/elastic-apm-agent-1.35.0.jar
Add OpenTelemetry Java Agent
ENV OTEL_AGENT_VERSION=1.28.0
ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OTEL_AGENT_VERSION}/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar
USER root
RUN chmod 777 /app/opentelemetry-javaagent.jar
Verify if the OpenTelemetry Java agent is successfully added
RUN ls -lh /app/opentelemetry-javaagent.jar
USER 1000
WORKDIR /app
Expose application port
EXPOSE 8081
Define entrypoint with OpenTelemetry agent and Elastic APM agent
CMD /jre/bin/java $JAVA_MEMORY_OPTS $GC_OPTS $JAVA_OPTS
-javaagent:/app/opentelemetry-javaagent.jar
-Djava.security.egd=file:/dev/./urandom
-jar app.jar
LOGS:
Error opening zip file or JAR manifest missing : /app/opentelemetry-javaagent.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Steps to reproduce
?
Expected behavior
?
Actual behavior
?
Javaagent or library instrumentation version
1.28, 1.27
Environment
JDK:
OS:
Additional context
No response