hrms-api-org/docker/Dockerfile

35 lines
614 B
Text
Raw Normal View History

2024-12-03 13:37:54 +07:00
# Build Stage
2025-08-05 05:35:23 +00:00
FROM node:22.17.1-alpine AS build-stage
2024-12-03 13:37:54 +07:00
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package*.json ./
RUN npm ci
# Copy source files and build the app
COPY . .
RUN npm run build
# Production Stage
2025-08-05 05:35:23 +00:00
FROM node:22.17.1-alpine
2024-12-03 13:37:54 +07:00
ENV NODE_ENV production
USER node
# 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 ./
RUN npm ci --production
# Define the entrypoint and default command
# If you have a custom entrypoint script
CMD [ "node", "dist/app.js" ]