# Development Dockerfile for Portfolio Next.js application
FROM node:20-alpine AS base

# Install dependencies for development
RUN apk add --no-cache libc6-compat curl

WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./

# Install all dependencies (including dev dependencies)
RUN npm ci

# Copy source code
COPY . .

# Expose port
EXPOSE 3000

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD curl -f http://localhost:3000 || exit 1

# Default command (can be overridden in docker-compose)
CMD ["npm", "run", "dev"]
