Closed mgralle closed 2 years ago
I am aware that this may not be a bug, but an intended feature of the plugin. Please indicate any workarounds!
I have found my mistake, it was about sbt scopes. The dockerCommands for the microservices that use AshScriptPlugin are not copied in from the other microservices, but created by AshScriptPlugin. So I had to edit the dockerCommands generated by AshScriptPlugin directly. FWIW, I did it this way:
lazy val otelCommands = Seq(
Cmd("WORKDIR", "/opt/"),
ExecCmd("RUN", "wget", "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar"),
Cmd("ENV", "JAVA_TOOL_OPTIONS=-javaagent:/opt/opentelemetry-javaagent.jar"),
Cmd("ENV", "OTEL_TRACES_EXPORTER=jaeger"),
Cmd("ENV", "OTEL_EXPORTER_JAEGER_ENDPOINT=collector.linkerd-jaeger.svc.cluster.local:55678")
)
...
dockerCommands := {
dockerCommands.value.flatMap {
// insert instrumentation commands in mainstage right before losing root privileges
case down@Cmd("USER", "daemon") => otelCommands :+ down
case other => Seq(other)
}
}
Expected behaviour
An additional jar file (for automatic instrumentation) should be placed in the docker image. I have tried two ways:
Those of my targets that don't include AshScriptPlugin create docker images as indicated. However, those that do include AshScriptPlugin completely ignore the modified dockerCommands.
<my-service>-impl/src/universal
, since the documentation says "By default, all files found in the src/universal directory are included in the distribution". However, the file is again not included in the docker images generated with the AshScriptPlugin.Actual behaviour
The docker image contains only the default AshScriptPlugin-generated content, not the opentelemetry-javaagent.jar.
Information
rpm --version
): Docker version 20.10.13, build a224086