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

How to use relative or absolute paths with INCLUDE+ #3

Closed
joehays opened this issue Mar 18, 2021 · 2 comments
Closed

How to use relative or absolute paths with INCLUDE+ #3

joehays opened this issue Mar 18, 2021 · 2 comments

Comments

@joehays
Copy link

joehays commented Mar 18, 2021

I get the following error when the 'Dockerfile.common' is not in the same directory.

failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Code(128) desc = Could not read file " ../../../mbKinDyn-algos/docker.requirements". Remember that the file path is relative to the build context, not the Dockerfile path.

I also tried using an absolute path and got the same error.

The third test was to make the CWD a parent of both the Dockerfile folder and the 'docker.requirements' folder and then I used a relative path to both the Dockerfile and 'docker.requirements' from the parent folder. This produced the same error.

I have multiple git repositories that are related to the Docker container that I'm building. Each repository has a 'docker.requirements' file that documents the dependencies that it needs backed into the docker image/container. So, I need the ability to keep these INSERT+ files in locations other than the main Dockerfile.

Thoughts?

@joehays joehays changed the title How to use absolute paths with INCLUDE+ How to use relative or absolute paths with INCLUDE+ Mar 18, 2021
@edrevo
Copy link
Owner

edrevo commented Mar 18, 2021

Can you share what's the file layout and the docker build command you are using?

@joehays
Copy link
Author

joehays commented Mar 19, 2021

It works correctly. My understanding of the build context was lacking...

say I have the following folder structure,

~/tmp
          sub/
                Dockerfile
          sub2/
                Dockerfile.common

if I'm in ~/tmp/sub then I can successfully build with the following

user:~/tmp/sub$docker build .. -f ./Dockerfile --no-cache -t test_include_plus

where Dockerfile is,

# syntax = edrevo/dockerfile-plus

FROM alpine

INCLUDE+ ./sub2/Dockerfile.common

ENTRYPOINT [ "mybin" ]

@joehays joehays closed this as completed Mar 19, 2021
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

2 participants