yes?
This commit is contained in:
parent
1164b4358b
commit
5865d55392
@ -1,17 +1,37 @@
|
||||
FROM node:20-alpine3.17
|
||||
# Stage 1: Builder
|
||||
FROM node:20-alpine3.17 AS builder
|
||||
|
||||
# Install pnpm
|
||||
# Install pnpm globally
|
||||
RUN npm install -g pnpm
|
||||
ENV PNPM_HOME=/usr/local/bin
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy necessary files for installation
|
||||
COPY package.json* pnpm-lock.yaml* pnpm-workspace.yaml* ./
|
||||
COPY common ./common
|
||||
COPY backend ./backend
|
||||
|
||||
RUN pnpm install --filter backend
|
||||
RUN pnpm run build:backend
|
||||
# Install dependencies for all workspaces, including backend
|
||||
RUN pnpm install
|
||||
|
||||
# Build the backend
|
||||
RUN pnpm --filter backend build
|
||||
|
||||
# Stage 2: Runner
|
||||
FROM node:20-alpine3.17 AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/backend/dist ./dist
|
||||
COPY --from=builder /app/backend/package.json ./backend/package.json
|
||||
|
||||
# Install production dependencies
|
||||
RUN npm install -g pnpm && pnpm install --prod
|
||||
|
||||
# Expose the port your application runs on
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["pnpm", "start:backend"]
|
||||
# Command to run your app
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
@ -10,6 +10,7 @@
|
||||
"start": "nest start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ssr/common": "workspace:*",
|
||||
"@nestjs/common": "^10.0.0",
|
||||
"@nestjs/core": "^10.0.0",
|
||||
"@nestjs/platform-express": "^10.0.0",
|
||||
@ -17,7 +18,6 @@
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ssr/common": "workspace:*",
|
||||
"concurrently": "^9.0.1",
|
||||
"nodemon": "^2.0.20",
|
||||
"tsup": "^8.3.0",
|
||||
|
@ -2,7 +2,9 @@ import { NestFactory } from "@nestjs/core";
|
||||
import { AppModule } from "./app.module";
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
logger: ["error", "warn"],
|
||||
});
|
||||
await app.listen(8080);
|
||||
}
|
||||
bootstrap();
|
||||
|
2
common/.dockerignore
Normal file
2
common/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
@ -1,15 +1,10 @@
|
||||
{
|
||||
"name": "@ssr/common",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "tsup src/index.ts --watch",
|
||||
"build": "tsup src/index.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"tsup": "^6.5.0",
|
||||
"typescript": "^5"
|
||||
|
@ -4,11 +4,11 @@
|
||||
"scripts": {
|
||||
"dev": "pnpm --parallel --workspace-concurrency=4 run -r dev",
|
||||
|
||||
"build:website": "pnpm --filter website... build",
|
||||
"build:backend": "pnpm --filter backend... build",
|
||||
"build:website": "pnpm --filter website build",
|
||||
"build:backend": "pnpm --filter backend build",
|
||||
|
||||
"start:website": "pnpm --filter website... start",
|
||||
"start:backend": "pnpm --filter backend... start"
|
||||
"start:website": "pnpm --filter website start",
|
||||
"start:backend": "pnpm --filter backend start"
|
||||
},
|
||||
"author": "fascinated7",
|
||||
"license": "MIT"
|
||||
|
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@ -36,7 +36,7 @@ importers:
|
||||
specifier: ^10.0.0
|
||||
version: 10.4.4(@nestjs/common@10.4.4(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.4(@nestjs/common@10.4.4(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.4)(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/platform-express@10.4.4(@nestjs/common@10.4.4(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.4))
|
||||
'@ssr/common':
|
||||
specifier: workspace:*
|
||||
specifier: workspace:common
|
||||
version: link:../common
|
||||
'@types/express':
|
||||
specifier: ^4.17.17
|
||||
|
@ -1,4 +1,4 @@
|
||||
packages:
|
||||
- "common"
|
||||
- "website"
|
||||
- "backend"
|
||||
- "common"
|
Reference in New Issue
Block a user