diff --git a/garden-service/src/plugins/maven-container/maven-container.ts b/garden-service/src/plugins/maven-container/maven-container.ts index ba19bf207d..da4d6e756f 100644 --- a/garden-service/src/plugins/maven-container/maven-container.ts +++ b/garden-service/src/plugins/maven-container/maven-container.ts @@ -31,6 +31,7 @@ import { containerModuleSpecSchema } from "../container/config" import { providerConfigBaseSchema } from "../../config/project" import { openJdks } from "./openjdk" import { maven } from "./maven" +import { LogEntry } from "../../logger/log-entry" const defaultDockerfilePath = resolve(STATIC_DIR, "maven-container", "Dockerfile") @@ -120,12 +121,7 @@ async function configure(params: ConfigureModuleParams) { async function getBuildStatus(params: GetBuildStatusParams) { const { module, log } = params - // Copy the default Dockerfile to the build directory, if the module doesn't provide one - // Note: Doing this here so that the build status check works as expected. - if (!(await containerHelpers.hasDockerfile(module))) { - log.debug(`Using default Dockerfile`) - await copy(defaultDockerfilePath, resolve(module.buildPath, "Dockerfile")) - } + await prepareBuild(module, log) return getContainerBuildStatus(params) } @@ -178,9 +174,19 @@ async function build(params: BuildModuleParams) { await copy(resolvedJarPath, resolve(module.buildPath, "app.jar")) // Build the container + await prepareBuild(module, log) return buildContainerModule(params) } +async function prepareBuild(module: MavenContainerModule, log: LogEntry) { + // Copy the default Dockerfile to the build directory, if the module doesn't provide one + // Note: Doing this here so that the build status check works as expected. + if (!(await containerHelpers.hasDockerfile(module))) { + log.debug(`Using default Dockerfile`) + await copy(defaultDockerfilePath, resolve(module.buildPath, "Dockerfile")) + } +} + async function loadPom(dir: string) { try { const pomPath = resolve(dir, "pom.xml")