This commit is contained in:
kittapath 2025-09-16 01:15:26 +07:00
parent 16426f1d0b
commit ec0aaf5b13

View file

@ -1,5 +1,5 @@
# Build Stage
FROM node:lts-alpine AS build-stage
FROM node:22.17.1-alpine AS build-stage
# Create app directory
WORKDIR /app
@ -11,25 +11,24 @@ RUN npm install
# Copy source files and build the app
COPY . .
#RUN npm ci
RUN npm run build
# Production Stage
FROM node:lts-alpine
ENV NODE_ENV=production
ENV NODE_ENV production
# Create app directory
WORKDIR /app
# Install only production dependencies as root first
COPY package*.json ./
RUN npm install --production && npm cache clean --force
# Copy built app from build stage
COPY --from=build-stage /app/dist ./dist
# Change ownership to node user and switch to node user
RUN chown -R node:node /app
# Install only production dependencies
COPY package*.json ./
#RUN npm ci --production
RUN npm install
USER node
# Define the entrypoint and default command