aws-codebuild-docker-images
aws-codebuild-docker-images copied to clipboard
Add support for excluding files/directories from mounted source
When local agent mounts source path, it includes all sub-directories including .git
, node_modules
, etc.
This either makes DOWNLOAD_SOURCE step very long or breaks local development environment most of the time, there must be some way to control which files are being mounted.
I also struggled with the 'DOWNLOAD_SOURCE' times but then re-read the flags and added '-m' so that the CodeBuild image mounts the specified source directory directly instead of creating a temporary copy.
./codebuild_build.sh -i <image> -s <path_to_repo> -m
Another workaround is to mount an empty folder with a compressed version of your code using git archive
or tar
then extract it in your buildspec.
It feels like -m should be the default behavior honestly considering this is used for local testing.
Mount the source directory directly might be created unexpected side effect. For example, npm install will be one of the steps in pre_build. The working directory will be polluted with mounting approach since node_modules are existed when development. Also, developers would expect the build is running is an isolated environment.
So I see 4 years later this is still not done. From what I understand we don't have the source for the local_builder so we can't do this ourselves, what have people been doing to avoid having the node_modules in the build?