testcontainers-jooq-codegen-maven-plugin icon indicating copy to clipboard operation
testcontainers-jooq-codegen-maven-plugin copied to clipboard

How do I get this to run in my docker build stage?

Open oluwatimilehin opened this issue 10 months ago • 3 comments

I have a Dockerfile that does a multistage build where the build stage looks like:

#
# Build stage
#
FROM maven:3.9.1-eclipse-temurin-17 AS build
WORKDIR /app
COPY src ./src
COPY pom.xml .

RUN --mount=type=cache,target=/root/.m2 mvn clean package

This fails when it runs mvn clean package with the error:

#0 3.561 [INFO] Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
#0 3.876 [INFO] docker-machine executable was not found on PATH ([/opt/java/openjdk/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin])
#0 3.876 [ERROR] Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
#0 3.876        UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
#0 3.876        DockerDesktopClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "java.nio.file.Path.toString()" because the return value of "org.testcontainers.dockerclient.DockerDesktopClientProviderStrategy.getSocketPath()" is null)As no valid configuration was found, execution cannot continue.

I understand that we need a valid docker daemon and there's none in the build stage, but I'm wondering if there's a workaround or maven flag I can specify to generate the sources without starting the container in the build stage. Any pointers on this, please?

oluwatimilehin avatar Aug 17 '23 07:08 oluwatimilehin