https://github.com/thdk/yarn-workspaces-nextjs-with-docker
Dockerize a nextjs app from withing a yarn workspaces monorepo
https://github.com/thdk/yarn-workspaces-nextjs-with-docker
Last synced: 5 months ago
JSON representation
Dockerize a nextjs app from withing a yarn workspaces monorepo
- Host: GitHub
- URL: https://github.com/thdk/yarn-workspaces-nextjs-with-docker
- Owner: thdk
- License: mit
- Created: 2023-01-20T21:04:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-20T21:07:30.000Z (over 3 years ago)
- Last Synced: 2024-12-29T13:48:28.428Z (over 1 year ago)
- Language: CSS
- Size: 893 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Run a nextjs app with docker in a monorepo with yarn workspaces
This is a research repo to investigate methods and best practices on how a nextjs app can be dockerized while the source code is in a yarn workspaces mono repo.
## Project structure
.
├── node_modules ------------ yarn workspaces will try to hoist all dependencies just once in the root
├── packages
├── lib ----------------- typescript package containing shared code
├── package.json
├── tsconfig.json
├── nextjs-app ---------- bare nextjs app (created with create-next-app)
├── Dockerfile
├── node_modules ---- when the app grows, some dependencies might end up here instead of in the root
├── package.json
├── package.json ------------ root package.json listing all workspaces (**/packages/*)
└── README.md
├── yarn.lock
## Run nextjs app with docker
```sh
docker build -t next-js-yarn-workspaces -f packages/nextjs-app/Dockerfile .
docker run --rm --publish 3000:3000 -e HOSTNAME=localhost next-js-yarn-workspaces
```