.
This commit is contained in:
31
qwen/nodejs/Dockerfile.dev
Normal file
31
qwen/nodejs/Dockerfile.dev
Normal file
@@ -0,0 +1,31 @@
|
||||
# Use the main image as the base (which has all dependencies)
|
||||
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 with nodemon for hot reloading
|
||||
CMD ["npm", "run", "dev"]
|
||||
Reference in New Issue
Block a user