devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.28k stars 359 forks source link

Allow user to specify which .dockerignore to use for image building #1356

Open ansonlc opened 3 years ago

ansonlc commented 3 years ago

Is your feature request related to a problem? our production image doesn’t include our tests in the image, but we want them in the dev image to reduce the size of the initial sync.

Which solution do you suggest? allow users to specify which .dockerignore to use for image building

Which alternative solutions exist? define a hook that calls a devspace custom command which could do something like this: mv .dockerignore ./devspace/.dockerignore cp .dockerignore_dev .dockerignore This hook could be triggered before image building and then a second hook could do this: mv -f ./devspace/.dockerignore .dockerignore And this second hook would run after image building

/kind feature

FabianKramm commented 3 years ago

@ansonlc thanks for creating this issue! I see, since docker buildkit has a similar feature where a .dockerignore can be specified as <dockerfile-name>.dockerignore, we thought we could implement a feature were devspace would prefer devspace.dockerignore over a regular .dockerignore. This would not require a new config option and should solve your issue. What do you think about this?

ansonlc commented 3 years ago

@ansonlc thanks for creating this issue! I see, since docker buildkit has a similar feature where a .dockerignore can be specified as <dockerfile-name>.dockerignore, we thought we could implement a feature were devspace would prefer devspace.dockerignore over a regular .dockerignore. This would not require a new config option and should solve your issue. What do you think about this? @FabianKramm that would be great! thanks for getting back to me so fast!