Next.js with Docker-Compose
参考PR
code:docker-compose.yml
version: "3.4"
services:
api:
build:
context: "./backend"
dockerfile: "Dockerfile.dev"
ports:
- 5000:5000
volumes:
- ./backend:/app/go
front:
build:
context: "./frontend"
dockerfile: "Dockerfile.dev"
ports:
- 3000:3000
volumes:
- ./frontend:/app/js
- /app/js/node_modules
- /app/js/.next
volumesに.nextを入れるのが重要
code:next.config.js
module.exports = {
webpackDevMiddleware: (config) => {
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300,
};
return config;
},
};
Hot reloadを利用するためにwebpackDevMiddlewareの設定を追加する