2025-08-03 19:23:20 +02:00
|
|
|
# Development Dockerfile
|
2025-07-17 13:54:51 +02:00
|
|
|
FROM node:18-alpine
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Install curl for healthchecks
|
|
|
|
|
RUN apk add --no-cache curl
|
|
|
|
|
|
|
|
|
|
# Set working directory
|
2025-07-17 13:54:51 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Copy package files first (better caching)
|
2025-07-17 13:54:51 +02:00
|
|
|
COPY package*.json ./
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Install all dependencies (including dev dependencies)
|
2025-07-17 13:54:51 +02:00
|
|
|
RUN npm ci
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Copy source code
|
2025-07-17 13:54:51 +02:00
|
|
|
COPY . .
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Create non-root user for security
|
|
|
|
|
RUN addgroup -g 1001 -S nodejs
|
|
|
|
|
RUN adduser -S reactjs -u 1001
|
|
|
|
|
USER reactjs
|
|
|
|
|
|
|
|
|
|
# Expose port 3000 (Vite default)
|
2025-07-17 13:54:51 +02:00
|
|
|
EXPOSE 3000
|
|
|
|
|
|
2025-08-03 19:23:20 +02:00
|
|
|
# Add healthcheck
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
|
|
|
CMD curl -f http://localhost:3000/ || exit 1
|
|
|
|
|
|
|
|
|
|
# Start development server with host binding
|
|
|
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|