-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: "docker compose run" with docker cache fails after building ( it can not find yarn installed module in cache folder) #6499
Comments
If i change |
I created a minimal branch for it https://github.com/uchar/yarnbugs/tree/yarn_docker_cache_error
Check docker logs and you should see this error :
|
First of all, The main issue here is There are a few things you can do here. First, you can use the tried-and-true technique of avoiding cache invalidation by installing sooner. FROM node:20-alpine
WORKDIR /app
+ RUN corepack enable
+
COPY package.json ./
COPY yarn.lock ./
+
+ RUN yarn --immutable
+
COPY tsconfig.json ./
-
COPY src ./src
ENV NODE_ENV=production
- RUN corepack enable
- RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \
- yarn --immutable
-
CMD sh -c " yarn $EXEC_COMMAND" If you still want to cache packages across builds you can use both the global cache and the local cache by setting - RUN yarn --immutable
+ RUN --mount=type=cache,target=/root/.yarn YARN_ENABLE_GLOBAL_CACHE="false" \
+ yarn --immutable |
Hi! 👋 It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it. |
Self-service
Describe the bug
I use this command to first build a docker image :
Then I use following command to run it :
But it fails with this error ( it works fine with old yarn v1 but not now with yarn v4 , I guess sth in yarn cause docker compose run fails)
This is my dockerfile
Also this is my dependencies in package.json ( tsx is already in dependencies)
To reproduce
It should be reprodusible from the bug discription but if it is necessary I can also make a repository for it and share it
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: