hrms-api-eva/docker/Dockerfile

37 lines
655 B
Text
Raw Normal View History

2024-12-04 17:25:34 +07:00
# Build Stage
2025-09-19 23:54:57 +07:00
FROM node:20.19.4-alpine AS build-stage
2024-12-04 17:25:34 +07:00
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
2025-09-19 23:54:57 +07:00
#RUN npm ci
RUN npm install
2024-12-04 17:25:34 +07:00
# Copy source files and build the app
COPY . .
RUN npm run build
# Production Stage
FROM node:lts-alpine
ENV NODE_ENV production
2025-09-19 23:54:57 +07:00
# USER node
2024-12-04 17:25:34 +07:00
# Create app directory
WORKDIR /app
# Copy built app from build stage
COPY --from=build-stage /app/dist ./dist
# Install only production dependencies
COPY package*.json ./
2025-09-19 23:54:57 +07:00
#RUN npm ci --production
RUN npm install
USER node
2024-12-04 17:25:34 +07:00
# Define the entrypoint and default command
# If you have a custom entrypoint script
CMD [ "node", "dist/app.js" ]