update for self-deploy using Docker

update

update

update for self-deploy using Docker
This commit is contained in:
2024-04-07 14:49:12 +07:00
committed by gabrielkheisa
parent 8c572600c0
commit 5b41c99602
3 changed files with 82 additions and 21 deletions

29
Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
# Stage 1: Build stage
FROM node:16 AS builder
# Set the working directory in the builder stage
WORKDIR /usr/src/app
# Copy the package.json and package-lock.json files to the builder stage
COPY package*.json ./
# Install npm dependencies in the builder stage
RUN npm install
# Copy the rest of the application code to the builder stage
COPY . .
# Stage 2: Production stage
FROM node:16-alpine
# Set the working directory in the production stage
WORKDIR /usr/src/app
# Copy the built artifacts from the builder stage to the production stage
COPY --from=builder /usr/src/app .
# Expose the port the app runs on
EXPOSE 3000
# Command to run the application in the production stage
CMD ["node", "index.js"]