https://github.com/jscheid/yarn-build-docker-test
https://github.com/jscheid/yarn-build-docker-test
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jscheid/yarn-build-docker-test
- Owner: jscheid
- Created: 2021-02-02T21:54:50.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-02T22:06:41.000Z (over 5 years ago)
- Last Synced: 2025-06-20T09:05:21.641Z (12 months ago)
- Language: Dockerfile
- Size: 582 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yarn workspaces + yarn.build + Docker caching
This is a (failing) test case for building a monorepo using [Yarn 2
workspaces](https://yarnpkg.com/features/workspaces) with
[yarn.build](https://yarn.build/) in Docker, taking advantage of the
[Docker build
cache](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache).
This monorepo contains three packages: `packageA`, `packageB`, and
`packageC`. `packageA` has no dependencies. `packageB` depends on
`packageA`, and `packageC` depends on `packageB`.
The Dockerfile first adds all files that are needed for Yarn to
install dependencies, and then runs `yarn` to do so. It then first
builds `packageA` which has no dependencies. Then it builds
`packageB`, which depends on `packageA`, which has already been
built. Finally, it builds `packageC`.
To execute the Dockerfile run the following command:
```
docker build .
```
The build fails because it tries to build `packageB` when its files
(other than `package.json`) have not been copied yet.