Dockerignore: can you specify the path of dockerignore file in docker-compose or command-line?
For the following directory structure:
/root/path/ <---- build context path
sub-project1/
sub-project2/
sub-project3/
root-project/
.dockerignore
Dockerfile
If .dockerignore is put under the /root/path/, it will be outside of all projects and could not checked into source contorl(e.g., git).
Ideally, it should be put under the root-project/, but it is not the build context. Is there a way to specify the file path of the .dockerignore file that will be applied to the whole build context? e.g.,
docker build -f root-project/Dockerfile
--dockerignore=root-project/.dockerignore
-t image:tag /root/path
docker-compose:
services:
web:
build:
dockerignore: root-project/.dockerignore
Dockerfile:
FROM scratch
WORKDIR /app/my_project
# copy all projects
COPY . .
// build project