forked from Chatbot/v3-api
first commit v3 initialiazed a temporary repository for darmanet client
This commit is contained in:
40
Dockerfile_old
Normal file
40
Dockerfile_old
Normal file
@@ -0,0 +1,40 @@
|
||||
# Stage 1: Build the application
|
||||
FROM node:20 AS build
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json for caching npm install
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies (use --frozen-lockfile for npm 7+)
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the app
|
||||
COPY . .
|
||||
|
||||
# Build the NestJS application
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production environment
|
||||
FROM node:20-slim AS production
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only necessary files from the build stage
|
||||
COPY --from=build /app/package*.json ./
|
||||
COPY --from=build /app/dist ./dist
|
||||
|
||||
# Install production dependencies only
|
||||
RUN npm ci --only=production
|
||||
|
||||
# Expose the app port (default for NestJS)
|
||||
EXPOSE 3000
|
||||
|
||||
# Set NODE_ENV to production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Run the application
|
||||
CMD ["node", "dist/main"]
|
||||
|
||||
Reference in New Issue
Block a user