Prevent intermediate file emission. Fix base image build.
diff --git a/pkg/cmd/local_run.go b/pkg/cmd/local_run.go
index 326bc8e..729d846 100644
--- a/pkg/cmd/local_run.go
+++ b/pkg/cmd/local_run.go
@@ -103,6 +103,18 @@
}
func (command *localRunCmdOptions) init() error {
+ if command.Containerize {
+ err := createDockerBaseWorkingDirectory()
+ if err != nil {
+ return err
+ }
+
+ err = createDockerWorkingDirectory()
+ if err != nil {
+ return err
+ }
+ }
+
return createMavenWorkingDirectory()
}
@@ -155,5 +167,17 @@
}
func (command *localRunCmdOptions) deinit() error {
+ if command.Containerize {
+ err := deleteDockerBaseWorkingDirectory()
+ if err != nil {
+ return err
+ }
+
+ err = deleteDockerWorkingDirectory()
+ if err != nil {
+ return err
+ }
+ }
+
return deleteMavenWorkingDirectory()
}
diff --git a/pkg/cmd/util_containerization.go b/pkg/cmd/util_containerization.go
index 86e7653..de7d5ea 100644
--- a/pkg/cmd/util_containerization.go
+++ b/pkg/cmd/util_containerization.go
@@ -86,7 +86,7 @@
// Run the command.
if err := cmd.Run(); err != nil {
- errors.Errorf("base image containerization did not run successfully: %v", err)
+ return errors.Errorf("base image containerization did not run successfully: %v", err)
}
return nil
@@ -94,6 +94,11 @@
func createAndBuildIntegrationImage(containerRegistry string, justBaseImage bool, image string,
propertyFiles []string, dependencies []string, routes []string) error {
+ // This ensures the Dockerfile for the base image will not end up in an undesired location.
+ if docker.BaseWorkingDirectory == "" {
+ return errors.New("base directory that holds the base image Dockerfile has not been set correctly")
+ }
+
docker.RegistryName = containerRegistry
if !justBaseImage {
registryName, err := docker.ExtractRegistryName(image)
@@ -114,6 +119,10 @@
return nil
}
+ if docker.IntegrationWorkingDirectory == "" {
+ return errors.New("integration directory that holds the image Dockerfile has not been set correctly")
+ }
+
// Create integration image if integration files were provided.
// Copy dependencies to a dependencies folder under a local directory.
err = updateIntegrationDependencies(dependencies)
@@ -162,7 +171,7 @@
// Run the command.
if err := cmd.Run(); err != nil {
- errors.Errorf("integration image did not run successfully: %v", err)
+ return errors.Errorf("integration image did not run successfully: %v", err)
}
return nil
diff --git a/pkg/util/docker/docker_base.go b/pkg/util/docker/docker_base.go
index 0149a6c..4424499 100644
--- a/pkg/util/docker/docker_base.go
+++ b/pkg/util/docker/docker_base.go
@@ -52,6 +52,7 @@
// Add path to Dockerfile:
dockerFile := path.Join(dockerFileDir, "Dockerfile")
+
args = append(args, DockerfilePathArg(dockerFile)...)
// Image name:
@@ -219,7 +220,7 @@
// RUNMavenInstall --
func RUNMavenInstall() string {
- return RUN("apk add --update maven && apk update && apk upgrade")
+ return RUN("apt-get update && apt-get install maven -y && apt-get upgrade -y")
}
// RUNMakeDir --