Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AbsoluteUnixPath for container.appRoot propagation #1012

Merged
merged 40 commits into from
Sep 20, 2018

Conversation

chanseokoh
Copy link
Member

Fixes #1011.

@chanseokoh chanseokoh changed the title Absolute unix path for app root Use AbsoluteUnixPath for container.appRoot propagation Sep 19, 2018
directoryInContext.resolve(
Paths.get(copyDirective.extractionPath).relativize(layerEntry.getExtractionPath()));
Path baseExtractionPath = Paths.get(copyDirective.extractionPath.toString());
Path relativeEntryPath = baseExtractionPath.relativize(layerEntry.getExtractionPath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe we can use copyDirective.extractionPath directly and add a relativize method to AbsoluteUnixPath after we change LayerEntry#getExtractionPath to return an AbsoluteUnixPath.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can think about this after #1014 (or in #1014).

public static final String DEFAULT_RELATIVE_CLASSES_PATH_ON_IMAGE = "classes/";
public static final String DEFAULT_RELATIVE_DEPENDENCIES_PATH_ON_IMAGE = "libs/";
public static final RelativeUnixPath DEFAULT_RELATIVE_RESOURCES_PATH_ON_IMAGE =
RelativeUnixPath.get("resources/");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the trailing slash.

appRoot + DEFAULT_RELATIVE_DEPENDENCIES_PATH_ON_IMAGE + "*"),
appRoot.resolve(DEFAULT_RELATIVE_RESOURCES_PATH_ON_IMAGE).toString(),
appRoot.resolve(DEFAULT_RELATIVE_CLASSES_PATH_ON_IMAGE).toString(),
appRoot.resolve(DEFAULT_RELATIVE_DEPENDENCIES_PATH_ON_IMAGE).toString() + "/*"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be appRoot.resolve(DEFAULT_RELATIVE_DEPENDENCIES_PATH_ON_IMAGE).resolve(RelativeUnixPath.get("*")).toString() to avoid the explicit string concatenation.

COPY resources /app/resources/
COPY classes /app/classes/
COPY exploded-war /exploded/war/
COPY libs /app/libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we actually need a trailing slash.

From https://docs.docker.com/engine/reference/builder/#copy:

If <dest> does not end with a trailing slash, it will be considered a regular file and the contents of <src> will be written at <dest>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch.

@chanseokoh chanseokoh merged commit fd89163 into master Sep 20, 2018
@chanseokoh chanseokoh deleted the AbsoluteUnixPath-for-appRoot branch September 20, 2018 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants