Dockerfile.dev•935 B
# Development Dockerfile with hot reload
FROM node:18-alpine
# Install development tools
RUN apk add --no-cache \
git \
curl \
bash \
&& npm install -g nodemon
# Set working directory
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S mcp -u 1001
# Copy package files
COPY package*.json ./
# Install all dependencies (including dev dependencies)
RUN npm install
# Change ownership of the app directory
RUN chown -R mcp:nodejs /app
# Switch to non-root user
USER mcp
# Set environment variables
ENV NODE_ENV=development
ENV LOG_LEVEL=debug
# Expose health check port
EXPOSE 3001
# Add health check
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD node -e "console.log('Health check passed')" || exit 1
# Start with nodemon for hot reload
CMD ["nodemon", "--watch", ".", "--ext", "js,json", "index.js"]