forked from Chatbot/v3-api
first commit v3 initialiazed a temporary repository for darmanet client
This commit is contained in:
55
Dockerfile_saman
Normal file
55
Dockerfile_saman
Normal file
@@ -0,0 +1,55 @@
|
||||
# Use the official Node.js image.
|
||||
FROM docker.si24.ir/node:20-alpine AS builder
|
||||
|
||||
# Create and change to the app directory.
|
||||
WORKDIR /app
|
||||
|
||||
# Copy application dependency manifests to the container image.
|
||||
COPY package*.json ./
|
||||
|
||||
# Specify the non-root user and set ownership (with verbose mode)
|
||||
RUN adduser -D ittalie
|
||||
RUN chown -Rv ittalie:ittalie /app
|
||||
|
||||
# Switch to the non-root user
|
||||
USER ittalie
|
||||
|
||||
# Install dependencies without running scripts
|
||||
RUN npm config set registry https://repo.si24.ir/repository/npm/
|
||||
RUN npm ci --ignore-scripts -d
|
||||
|
||||
# Copy only the necessary source code
|
||||
COPY src/ ./src/
|
||||
COPY tsconfig.json ./
|
||||
COPY nest-cli.json ./
|
||||
COPY public ./public/
|
||||
|
||||
# Build the NestJS application.
|
||||
RUN npm run build
|
||||
|
||||
# --- Production Stage ---
|
||||
FROM docker.si24.ir/node:22-alpine
|
||||
|
||||
# Create and change to the app directory.
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json for production dependencies.
|
||||
COPY package*.json ./
|
||||
|
||||
# Specify the non-root user and set ownership (with verbose mode)
|
||||
RUN adduser -D ittalie
|
||||
RUN chown -Rv ittalie:ittalie /app
|
||||
|
||||
# Switch to the non-root user
|
||||
USER ittalie
|
||||
|
||||
# Install dependencies without running scripts
|
||||
RUN npm config set registry https://repo.si24.ir/repository/npm/
|
||||
RUN npm ci --ignore-scripts -d
|
||||
|
||||
|
||||
# Copy the built application from the builder stage.
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Run the web service on container startup.
|
||||
CMD ["npm", "run", "start:prod"]
|
||||
Reference in New Issue
Block a user