Starter TypeScript template for Learn Next.js with Docker and linting. Using Docker setup from https://dev.to/chrsgrrtt/dockerising-a-next-js-project-1ck5.
Run docker-compose to spin up the services:
docker-compose build
New dependencies can be installed using the npm
service, which will install the dependencies on the volume shared with dev
service:
docker-compose run npm i -s moment
If you need node_modules
on the host to enable formatting and linting in VS Code, you will need to also install the dependencies on the host:
npm install
In VS Code, Ctrl + Shift + P
> Preferences: Open Settings (JSON)
; add these items:
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": ["typescript", "typescriptreact"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
Run the dev
service:
docker-compose up dev
Next.js runs at http://localhost:3000.