build
This commit is contained in:
parent
16426f1d0b
commit
ec0aaf5b13
1 changed files with 7 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue