docker build failing after upgrade to @nrwl/workspace 13.4.6
See original GitHub issueCurrent Behavior
After the upgrade to version 13.4.6 of @nrwl/workspace
, docker builds are failing as the build commands
are assuming that git is available, which won’t be the case in most docker builds that use slim base images.
Expected Behavior
As in versions <13.4.6, I’d expect the build commands to not attempt executing git since git won’t always be available, for various reasons.
Steps to Reproduce
To reproduce the issue, take a look at https://github.com/bahizi/nx-docker-build. Clone the repo and try running a simple docker build .
in the root directory.
The fix/docker-build
branch will work as expected, since there we’re using @nrwl/workspace@13.4.5
Failure Logs
> nx-docker-build@0.0.0 ng /home/airline
> nx "run" "api:build"
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn git',
path: 'git',
spawnargs: [ 'ls-files', '-s', '-z', '--exclude-standard', '.' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nx-docker-build@0.0.0 ng: `nx "run" "api:build"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nx-docker-build@0.0.0 ng script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Environment
Docker. The node:14.18.2-alpine3.14
image
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:10
Top Results From Across the Web
Docker build fails after os Upgrade - Stack Overflow
I recently upgraded the OS and then tried to upgrade to the latest version of redmine. My Dockerfile basically gets the latest Redmine...
Read more >Update the application | Docker Documentation
Update the application. In part 2, you containerized a todo application. In this part, you will update the application and container image.
Read more >@nrwl/workspace - npm
The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and ......
Read more >Why new Macs break your Docker build, and how to fix it
So it can be a little confusing when you try to build your Python-based Dockerfile on a new Mac, and everything starts failing....
Read more >Troubleshooting errors with Docker commands when using ...
You may receive the error Filesystem verification failed when using the docker pull command to pull an image from an Amazon ECR repository...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have had the same issue but I have managed to fix it. I had to install git in the container as nx makes use of git history. Try
apt-get update && apt-get install git
orapk update && apk add git
.After looking at this more, figured out a simple and elegant way to solve the issue without installing git in my container image: add
.git
to the.dockerignore
file.Sample fix in the original ‘reproduce’ repo, in the
fix/update-gitignore
branch: https://github.com/bahizi/nx-docker-build/tree/fix/update-gitignore.