Closed ascopes closed 2 years ago
Current workaround:
FROM wiremock/wiremock:latest-alpine
RUN apk add --no-cache curl \
&& curl -o /var/wiremock/lib/logback-classic.jar https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar \
&& curl -o /var/wiremock/lib/logback-core.jar https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.11/logback-core-1.2.11.jar
With TestContainers:
@Bean(autowireCandidate = false)
public ImageFromDockerfile wireMockImage() {
var jars = Map.of(
"logback-classic.jar", "https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar",
"logback-core.jar", "https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.2.11/logback-core-1.2.11.jar"
);
return new ImageFromDockerfile("me/wiremock-patch-gh-51", true)
.withDockerfileFromBuilder(bldr -> {
bldr.from("wiremock/wiremock:2.33.2-alpine")
.run("apk", "add", "-q", "--no-cache", "curl");
jars.forEach((target, url) -> {
log.info("[wiremock-docker gh-51] curl -o {} {}", target, url);
bldr.run("curl", "--fail", "-o", "/var/wiremock/lib/" + target, url);
});
});
}
This repository only handles Docker packaging of Wiremock standalone jar.
Here is the explanation on why slf4j implementation are not included in the jar : https://github.com/wiremock/wiremock/issues/258#issuecomment-91491412
@rodolpheche The linked issue only addresses the non-standalone JAR, not the standalone one. Those questions went unanswered since 2019, so I am still a little confused.
Should I be opening an issue on the Wiremock repository itself instead, or is it expected behaviour that the standalone copy needs additional JARs to allow logging to work correctly?
Any advice would be greatly appreciated
The explanation is the same for both standalone JAR and not-standalone JAR.
You could ask to @tomakehurst but I think you'll get the same answer : those who want to get technical logs from execution should bring their own slf4j implementation
It appears both the debian-based and alpine-based container images are missing an SLF4J logger implementation on the classpath.
I understand that the non-standalone JAR of WireMock does not contain an implementation of SLF4J, but that the standalone JAR should. I assume the standalone JAR should be the one being used in this image, so I am not entirely sure what is going on.
Reproduction steps
Debian
docker run -it --rm wiremock/wiremock:2.32.0 --verbose
Alpine
docker run -it --rm wiremock/wiremock:2.32.0-alpine --verbose