git clone https://github.com/moofoo/turbo-docker-monorepo && cd turbo-docker-monorepo && yarn && yarn workspace shared-module build && yarn
docker compose [OPTIONS] COMMAND
docker compose -f docker-compose.prod.yml [OTHER OPTIONS] COMMAND
docker compose stop && docker compose up -d -V --build --force-recreate
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
};
module.exports = nextConfig;
- package.json (added 'server' script)
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"server": "node server.js"
},
"dependencies": {
"@types/node": "20.1.7",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"eslint": "8.40.0",
"eslint-config-next": "13.4.2",
"next": "13.4.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.0.4"
}
}
import {NestFactory} from "@nestjs/core";
import {AppModule} from "./app.module";
import {exampleFunc} from "shared-module"; // from packages/shared-module
async function bootstrap() {
const app = await NestFactory.create(AppModule);
exampleFunc();
await app.listen(process.env.PORT || 3333, process.env.IN_CONTAINER === "1" ? "0.0.0.0" : "127.0.0.1");
}
bootstrap();
Follow these steps when adding app dependencies:
yarn workspace add APP_NAME DEPENDENCY (or yarn workspace add -D ... for dev deps)
for example,
yarn workspace backend add bcrypt
docker compose up -d -V --force-recreate --build backend
docker compose restart