-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit be02841
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM node | ||
|
||
RUN mkdir /app | ||
COPY . /app | ||
|
||
WORKDIR /app | ||
RUN yarn | ||
|
||
ENTRYPOINT ["yarn", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
This project recreates the issues with layers disappearing from images when using the `cache-from` argument. | ||
|
||
To recreate run the following steps: | ||
|
||
``` | ||
DOCKER_BUILDKIT=1 docker build -t cgreening/cache_problem:1 . --build-arg BUILDKIT_INLINE_CACHE=1 | ||
docker push cgreening/cache_problem:1 | ||
docker run -it --entrypoint /bin/bash cgreening/cache_problem:1 | ||
root@f3b83bd929e6:/app# ls | ||
Dockerfile README.md index.js node_modules package.json yarn.lock | ||
``` | ||
|
||
Clean up just like on the build machine: | ||
|
||
``` | ||
docker system prune -a | ||
``` | ||
|
||
Build again | ||
|
||
``` | ||
DOCKER_BUILDKIT=1 docker build -t cgreening/cache_problem:2 . --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from cgreening/cache_problem:1 | ||
docker push cgreening/cache_problem:2 | ||
docker run -it --entrypoint /bin/bash cgreening/cache_problem:2 | ||
root@f3b83bd929e6:/app# ls | ||
Dockerfile README.md index.js node_modules package.json yarn.lock | ||
``` | ||
|
||
Clean up again: | ||
|
||
``` | ||
docker system prune -a | ||
``` | ||
|
||
Build again | ||
|
||
``` | ||
DOCKER_BUILDKIT=1 docker build -t cgreening/cache_problem:3 . --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from cgreening/cache_problem:2 | ||
docker push cgreening/cache_problem:3 | ||
docker run -it --entrypoint /bin/bash cgreening/cache_problem:3 | ||
root@462e81ea94e4:/app# ls | ||
Dockerfile README.md index.js package.json | ||
``` | ||
|
||
You will see that there is no `node_modules` folder. This folder should have been created by the step: | ||
|
||
``` | ||
RUN yarn | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("It works!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "docker-cache-issue", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "Chris Greening <[email protected]>", | ||
"license": "MIT" | ||
} |