aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-05-30 00:07:11 -0400
committerJeff Johnston2018-05-30 11:39:02 -0400
commit634a212204e5fd5e156669c5bd2f411e578621cd (patch)
tree32814b5b90d08bd0aadf4c6fe377c288871eb025
parentda57b8881279310261a67159992135d140ca8c20 (diff)
downloadorg.eclipse.linuxtools-634a212204e5fd5e156669c5bd2f411e578621cd.tar.gz
org.eclipse.linuxtools-634a212204e5fd5e156669c5bd2f411e578621cd.tar.xz
org.eclipse.linuxtools-634a212204e5fd5e156669c5bd2f411e578621cd.zip
Bug 535167 - "Build Image..." run config doesn't accept *.dockerfile
- change Build Image shortcut to allow .dockerfile extension - save the dockerfile name as a configuration attribute and default to Dockerfile if not found in configuration - change the Build Image config page main tab to show the dockerfile name in addition to the directory - add a new buildImage method to DockerConnection that takes the dockerfile name as a parameter and calls the corresponding docker-client method that allows dockerfile name specification Change-Id: I5a3338ccc5969d0091951d76ca6d3680540aa908 Reviewed-on: https://git.eclipse.org/r/123586 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> Reviewed-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerImageBuildOptions.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java40
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/plugin.xml11
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/BuildImageCommandHandler.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/jobs/BuildDockerImageJob.java19
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationDelegate.java4
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationMainTab.java26
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java7
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/IBuildDockerImageLaunchConfigurationConstants.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchConfigurationUtils.java2
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchMessages.properties1
11 files changed, 102 insertions, 17 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerImageBuildOptions.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerImageBuildOptions.java
index 5400621528..333d5e340c 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerImageBuildOptions.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerImageBuildOptions.java
@@ -25,6 +25,9 @@ public interface IDockerImageBuildOptions {
/** repo and optionally tag of Image to build. */
String REPO_NAME = "repoName"; //$NON-NLS-1$
+ /** dockerfile name. */
+ String DOCKERFILE_NAME = "dockerfileName"; //$NON-NLS-1$
+
/** quiet build option. */
String QUIET_BUILD = "quietBuild"; //$NON-NLS-1$
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index 54aab95224..7fa08eaf94 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -1420,6 +1420,46 @@ public class DockerConnection
}
/**
+ * Builds an {@link IDockerImage}
+ *
+ * @param path
+ * path to the build context
+ * @param name
+ * optional name and tag of the image to build
+ * @param dockerFileName
+ * name of dockerfile
+ * @param handler
+ * progress handler
+ * @param buildOptions
+ * build options
+ * @return the id of the {@link IDockerImage} that was build
+ * @throws DockerException
+ * if building image failed
+ * @throws InterruptedException
+ * if the thread was interrupted
+ */
+ // TODO: add this method in the public interface
+ public String buildImage(final IPath path, final String name,
+ final String dockerFileName, final IDockerProgressHandler handler,
+ final Map<String, Object> buildOptions)
+ throws DockerException, InterruptedException {
+ try {
+ final DockerProgressHandler d = new DockerProgressHandler(handler);
+ final java.nio.file.Path p = FileSystems.getDefault()
+ .getPath(path.makeAbsolute().toOSString());
+ String res = getClientCopy().build(p, name, dockerFileName, d,
+ getBuildParameters(buildOptions));
+ return res;
+ } catch (com.spotify.docker.client.exceptions.DockerRequestException e) {
+ throw new DockerException(e.message());
+ } catch (com.spotify.docker.client.exceptions.DockerException
+ | IOException e) {
+ DockerException f = new DockerException(e);
+ throw f;
+ }
+ }
+
+ /**
* Converts the given {@link Map} of build options into an array of
* {@link BuildParameter} when the build options are set a value different
* from the default value.
diff --git a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
index 377863ac0d..940ef37ee6 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
+++ b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
@@ -2706,11 +2706,18 @@
<adapt
type="org.eclipse.core.resources.IResource">
<and>
- <test
+ <or>
+ <test
forcePluginActivation="true"
property="org.eclipse.core.resources.name"
value="Dockerfile">
- </test>
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.core.resources.extension"
+ value="dockerfile">
+ </test>
+ </or>
</and>
</adapt>
</iterate>
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/BuildImageCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/BuildImageCommandHandler.java
index 5e360db5dc..44e9c44f05 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/BuildImageCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/BuildImageCommandHandler.java
@@ -103,6 +103,7 @@ public class BuildImageCommandHandler extends AbstractHandler {
@SuppressWarnings("unused")
final int lines = wizard.getNumberOfLines();
final IPath path = wizard.getDirectory();
+ final String dockerfileName = "Dockerfile"; //$NON-NLS-1$
monitor.beginTask(DVMessages.getString(BUILD_IMAGE_JOB_TITLE),
2);
@@ -157,7 +158,7 @@ public class BuildImageCommandHandler extends AbstractHandler {
monitor.subTask(
DVMessages.getString(BUILD_IMAGE_JOB_TITLE));
final Job buildImageJob = new BuildDockerImageJob(
- connection, path, id, null);
+ connection, path, dockerfileName, id, null);
buildImageJob.schedule();
monitor.worked(1);
} finally {
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/jobs/BuildDockerImageJob.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/jobs/BuildDockerImageJob.java
index 9bc3071a88..eeace40c12 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/jobs/BuildDockerImageJob.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/jobs/BuildDockerImageJob.java
@@ -61,6 +61,9 @@ public class BuildDockerImageJob extends Job implements IDockerProgressHandler {
/** the build options. */
private final Map<String, Object> buildOptions;
+ /** The name of the dockerfile (defaults to Dockerfile) */
+ private final String dockerfileName;
+
/** the optional repoName (i.e., repo[tag]) for the image to build */
private final String repoName;
@@ -88,11 +91,12 @@ public class BuildDockerImageJob extends Job implements IDockerProgressHandler {
* options.
*/
public BuildDockerImageJob(final IDockerConnection connection,
- final IPath path, final String repoName,
+ final IPath path, final String dockerfileName, final String repoName,
final Map<String, Object> buildOptions) {
super(JobMessages.getString(BUILD_IMAGE_JOB_TITLE));
this.connection = connection;
this.path = path;
+ this.dockerfileName = dockerfileName;
this.repoName = repoName;
this.buildOptions = buildOptions;
this.console = BuildConsole.findConsole();
@@ -127,8 +131,9 @@ public class BuildDockerImageJob extends Job implements IDockerProgressHandler {
protected IStatus run(final IProgressMonitor progressMonitor) {
try {
this.progressMonitor = progressMonitor;
- final IPath pathToDockerfile = path.addTrailingSeparator()
- .append("Dockerfile"); //$NON-NLS-1$
+
+ final IPath pathToDockerfile = path.append(dockerfileName);
+
if (verifyPathToDockerfile(pathToDockerfile)) {
final int numberOfBuildOperations = countLines(
pathToDockerfile.toOSString()); // $NON-NLS-1$
@@ -154,11 +159,11 @@ public class BuildDockerImageJob extends Job implements IDockerProgressHandler {
// unique.
final String name = "dockerfile:" //$NON-NLS-1$
+ Long.toHexString(System.currentTimeMillis());
- ((DockerConnection) connection).buildImage(this.path,
- name, this, this.buildOptions);
+ ((DockerConnection) connection).buildImage(pathToDockerfile.removeLastSegments(1),
+ name, this.dockerfileName, this, this.buildOptions);
} else {
- ((DockerConnection) connection).buildImage(this.path,
- this.repoName, this, this.buildOptions);
+ ((DockerConnection) connection).buildImage(pathToDockerfile.removeLastSegments(1),
+ this.repoName, this.dockerfileName, this, this.buildOptions);
}
connection.getImages(true);
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationDelegate.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationDelegate.java
index ffdbff8cd5..a2f93dbb43 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationDelegate.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationDelegate.java
@@ -19,6 +19,7 @@ import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.NO_CAC
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.QUIET_BUILD;
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.REPO_NAME;
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.RM_INTERMEDIATE_CONTAINERS;
+import static org.eclipse.linuxtools.internal.docker.ui.launch.IBuildDockerImageLaunchConfigurationConstants.DOCKERFILE_NAME;
import static org.eclipse.linuxtools.internal.docker.ui.launch.IBuildDockerImageLaunchConfigurationConstants.SOURCE_PATH_LOCATION;
import static org.eclipse.linuxtools.internal.docker.ui.launch.IBuildDockerImageLaunchConfigurationConstants.SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION;
@@ -57,6 +58,7 @@ public class BuildDockerImageLaunchConfigurationDelegate
final boolean sourcePathWorkspaceRelativeLocation = configuration
.getAttribute(SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION,
false);
+ final String dockerfileName = configuration.getAttribute(DOCKERFILE_NAME, "Dockerfile"); //$NON-NLS-1$
final IPath sourcePath = BuildDockerImageUtils.getPath(
sourcePathLocation,
sourcePathWorkspaceRelativeLocation);
@@ -76,7 +78,7 @@ public class BuildDockerImageLaunchConfigurationDelegate
.getAttribute(FORCE_RM_INTERMEDIATE_CONTAINERS, false));
if (connection != null && sourcePath != null) {
final Job buildImageJob = new BuildDockerImageJob(connection,
- sourcePath, repoName, buildOptions);
+ sourcePath, dockerfileName, repoName, buildOptions);
buildImageJob.schedule();
} else {
final ILaunchGroup launchGroup = DebugUITools
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationMainTab.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationMainTab.java
index 687e5e0303..96b4d9a89f 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationMainTab.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageLaunchConfigurationMainTab.java
@@ -13,6 +13,7 @@
package org.eclipse.linuxtools.internal.docker.ui.launch;
+import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.DOCKERFILE_NAME;
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.DOCKER_CONNECTION;
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.FORCE_RM_INTERMEDIATE_CONTAINERS;
import static org.eclipse.linuxtools.docker.core.IDockerImageBuildOptions.NO_CACHE;
@@ -72,6 +73,7 @@ public class BuildDockerImageLaunchConfigurationMainTab
private final String BROWSE_WORKSPACE = "BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browseworkspace.button.label"; //$NON-NLS-1$
private final String BROWSE_WORKSPACE_DIALOG_TITLE = "BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browseworkspace.dialog.title"; //$NON-NLS-1$
private final String BROWSE_FILESYSTEM = "BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browsefilesystem.button.label"; //$NON-NLS-1$
+ private final String DOCKERFILE_NAME_LABEL = "BuildDockerImageLaunchConfigurationMainTab.dockerfileName.label"; //$NON-NLS-1$
private final String REPO_NAME_LABEL = "BuildDockerImageLaunchConfigurationMainTab.repoName.label"; //$NON-NLS-1$
private final String REPO_NAME_MISSING = "BuildDockerImageLaunchConfigurationMainTab.repoName.missing"; //$NON-NLS-1$
private final String OPTIONS_LABEL = "BuildDockerImageLaunchConfigurationMainTab.options.group.label"; //$NON-NLS-1$
@@ -88,6 +90,8 @@ public class BuildDockerImageLaunchConfigurationMainTab
private boolean buildContextPathWorkspaceRelative;
/** build option: name and optional tag. */
private Text repoNameText;
+ /** build option: dockerfile name. */
+ private Text dockerfileNameText;
/** build option: do not use cache. */
private Button noCacheButton;
/** build option: quiet mode. */
@@ -130,8 +134,8 @@ public class BuildDockerImageLaunchConfigurationMainTab
createBuildContextPathGroup(container);
// repository name
createRepoNameGroup(container);
- // dockerfile path
- // createDockerfilePathGroup(container);
+ // dockerfile name
+ createDockerfileNameGroup(container);
// build options
createBuildOptionsGroup(container);
}
@@ -188,6 +192,17 @@ public class BuildDockerImageLaunchConfigurationMainTab
.addModifyListener(new LaunchConfigurationChangeListener());
}
+ private void createDockerfileNameGroup(final Composite container) {
+ final Group dockerfileNameGroup = new Group(container, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(dockerfileNameGroup);
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(1).applyTo(dockerfileNameGroup);
+ dockerfileNameGroup.setText(LaunchMessages.getString(DOCKERFILE_NAME_LABEL));
+
+ this.dockerfileNameText = new Text(dockerfileNameGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(this.dockerfileNameText);
+ this.dockerfileNameText.addModifyListener(new LaunchConfigurationChangeListener());
+ }
+
private void createBuildOptionsGroup(final Composite container) {
final Group optionsGroup = new Group(container, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL)
@@ -303,6 +318,7 @@ public class BuildDockerImageLaunchConfigurationMainTab
configuration.getAttribute(SOURCE_PATH_LOCATION, ""));
this.buildContextPathWorkspaceRelative = configuration.getAttribute(
SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION, false);
+ this.dockerfileNameText.setText(configuration.getAttribute(DOCKERFILE_NAME, "Dockerfile")); //$NON-NLS-1$
this.repoNameText
.setText(configuration.getAttribute(REPO_NAME, ""));
this.quietBuildButton.setSelection(
@@ -329,6 +345,7 @@ public class BuildDockerImageLaunchConfigurationMainTab
// verify the source path
final String sourcePathLocation = launchConfig
.getAttribute(SOURCE_PATH_LOCATION, ""); // $NON-NLS-1$
+ final String dockerfileName = launchConfig.getAttribute(DOCKERFILE_NAME, "Dockerfile"); //$NON-NLS-1$
final boolean sourcePathWorkspaceRelativeLocation = launchConfig.getAttribute(SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION, false);
final IPath sourcePath = BuildDockerImageUtils.getPath(
sourcePathLocation, sourcePathWorkspaceRelativeLocation);
@@ -341,7 +358,7 @@ public class BuildDockerImageLaunchConfigurationMainTab
setErrorMessage(
LaunchMessages.getString(BUILD_CONTEXT_PATH_MISSING));
return false;
- } else if (!sourcePath.append("Dockerfile").toFile().exists()) {
+ } else if (!sourcePath.append(dockerfileName).toFile().exists()) {
setErrorMessage(LaunchMessages.getString(BUILD_CONTEXT_PATH_MISSING_DOCKERFILE));
return false;
} else {
@@ -375,6 +392,9 @@ public class BuildDockerImageLaunchConfigurationMainTab
if (!this.repoNameText.getText().isEmpty()) {
configuration.setAttribute(REPO_NAME, this.repoNameText.getText());
}
+ if (!this.dockerfileNameText.getText().isEmpty()) {
+ configuration.setAttribute(DOCKERFILE_NAME, this.dockerfileNameText.getText());
+ }
configuration.setAttribute(QUIET_BUILD,
this.quietBuildButton.getSelection());
configuration.setAttribute(NO_CACHE, this.noCacheButton.getSelection());
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
index e6acf66417..3a28036791 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/BuildDockerImageShortcut.java
@@ -51,10 +51,11 @@ public class BuildDockerImageShortcut
final boolean workspaceRelative = config.getAttribute(
IBuildDockerImageLaunchConfigurationConstants.SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION,
false);
- final IPath dockerfilePath = getPath(sourcePath,
- workspaceRelative);
+ final String dockerfileName = config
+ .getAttribute(IBuildDockerImageLaunchConfigurationConstants.DOCKERFILE_NAME, "Dockerfile"); //$NON-NLS-1$
+ final IPath dockerfilePath = getPath(sourcePath, workspaceRelative).append(dockerfileName);
return dockerfilePath
- .equals(resource.getLocation().removeLastSegments(1));
+ .equals(resource.getLocation());
} catch (CoreException e) {
Activator.log(e);
return false;
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/IBuildDockerImageLaunchConfigurationConstants.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/IBuildDockerImageLaunchConfigurationConstants.java
index a22f9c7d30..98c735938a 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/IBuildDockerImageLaunchConfigurationConstants.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/IBuildDockerImageLaunchConfigurationConstants.java
@@ -38,6 +38,9 @@ public interface IBuildDockerImageLaunchConfigurationConstants
*/
String SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION = "sourcePathWorkspaceRelativeLocation"; //$NON-NLS-1$
+ /** the name of the dockerfile. */
+ String DOCKERFILE_NAME = "dockerfileName"; //$NON-NLS-1$
+
/** the path to the dockerfile. */
String DOCKERFILE_PATH = "dockerfilePath"; //$NON-NLS-1$
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchConfigurationUtils.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchConfigurationUtils.java
index 9ade1780f4..1a3c3aef1a 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchConfigurationUtils.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchConfigurationUtils.java
@@ -640,6 +640,8 @@ public class LaunchConfigurationUtils {
wc.setAttribute(
IBuildDockerImageLaunchConfigurationConstants.SOURCE_PATH_LOCATION,
dockerfile.getFullPath().removeLastSegments(1).toString());
+ wc.setAttribute(IBuildDockerImageLaunchConfigurationConstants.DOCKERFILE_NAME,
+ dockerfile.getFullPath().lastSegment());
wc.setAttribute(
IBuildDockerImageLaunchConfigurationConstants.SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION,
true);
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchMessages.properties b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchMessages.properties
index de02e2b796..0b950a1d71 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchMessages.properties
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/LaunchMessages.properties
@@ -23,6 +23,7 @@ BuildDockerImageLaunchConfigurationMainTab.buildContextPath.missingDockerfile=Bu
BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browseworkspace.button.label=Browse Workspace...
BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browseworkspace.dialog.title=Browse Workspace...
BuildDockerImageLaunchConfigurationMainTab.buildContextPath.browsefilesystem.button.label=Browse File System...
+BuildDockerImageLaunchConfigurationMainTab.dockerfileName.label=Dockerfile name
BuildDockerImageLaunchConfigurationMainTab.dockerfilePath.group.label=Dockerfile Path:
BuildDockerImageLaunchConfigurationMainTab.repoName.label=Repository name (and optional tag)
BuildDockerImageLaunchConfigurationMainTab.repoName.missing=A repository name is recommended