Files
MOHPortalTest-AllAgents-All…/qwen/nodejs/Dockerfile
2025-10-24 17:06:14 -05:00

32 lines
837 B
Docker

# Use Node.js 18 LTS as the base image
FROM node:18-alpine
# Set working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install all dependencies (including dev dependencies)
RUN npm install
# Install nodemon globally for development
RUN npm install -g nodemon
# Copy the rest of the application code
COPY . .
# Create a non-root user and switch to it
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Change ownership of the app directory to the non-root user
RUN chown -R nextjs:nodejs /app
USER nextjs
# Expose the port the app runs on
EXPOSE 19000
# Define the command to run the application
# Default to production, but can be overridden
CMD ["sh", "-c", "if [ \"$NODE_ENV\" = \"development\" ] ; then npm run dev ; else npm start ; fi"]