I have a repository where I need to create several Dockerfiles, but each of them should have a different context.
I like the solution posted here, but it doesn't fully fit with my use case.
NO, THIS IS NOT A DUPLICATE. IT'S A DIFFERENT USE CASE. PLEASE KEEP READING.
I know it's better to exclude from the context unnecessary folders, especially if they are big. Well, my project consists of several folders, some of them are really huge.
For simplicity, suppose this is the file tree of my project:
hugeFolder1/
hugeFolder2/
littleFolder1/
littleFolder2/
And suppose that I need to create two Dockerfiles (following the solution that I previously mentioned):
docker/A/Dockerfile
<- let's call this Dockerfile "A"docker/B/Dockerfile
<- let's call this Dockerfile "B"docker-compose.yml
Now the point is:
- A only needs
hugeFolder1
and both the little folders. - B only needs
hugeFolder2
and both the little folders.
So I would like to exclude the unneeded huge folders respectively.
What is the best way to achieve this?