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

Plugin does not correctly handle bind mounts when BuildKit is enabled or when the source is the context not another Image. #4

Closed
nigelgbanks opened this issue Feb 5, 2021 · 3 comments
Assignees

Comments

@nigelgbanks
Copy link
Collaborator

Currently the plugin adds COPY commands when for bind mounts always, it should only do this in the case when BuildKit is disabled.

Additionally it should distinguish between contextual bind mounts and bind mounts from another image as the syntax of the COPY command changes depending on the source type (contextual, bind). At the moment contextual bind mounts are not supported by this plugin.

See the documentation for bind mounts

Currently using the following syntax (where extensions is a folder in the docker build context):

RUN --mount=type=bind,from=extensions,source=.,target=/extensions

Will get converted into

COPY --from=extensions . /extensions

Which will fail as the build system will be looking for the Docker image extensions producing an error like the following:

ERROR: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

The generated copy should look like so:

COPY extensions/  /extensions/

The generation of the COPY instruction will become a bit more complex in that it will need to account for relative paths the current version does not as when specifying source for images absolute paths are required as there is no relative path. This is not the case with bind mounts of the Docker build context.

@nigelgbanks nigelgbanks self-assigned this Feb 5, 2021
@nigelgbanks
Copy link
Collaborator Author

Note that changing this we can still have an unavoidable bug in that if a FROM alias has the same name as a folder in the Drupal context we can't distinguish between the two and what is intended.

@nigelgbanks
Copy link
Collaborator Author

Note that changing this we can still have an unavoidable bug in that if a FROM alias has the same name as a folder in the Drupal context we can't distinguish between the two and what is intended.

If I'm reading the docs correctly in that case the user should drop the from=value to indicate that it from should be the build context to distinguish between the two so there is a way to make this clear.

@nigelgbanks
Copy link
Collaborator Author

Resolved with version 0.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant