# Frontend Development Dockerfile for Placebo.mk TanStack React App

FROM node:20-alpine

WORKDIR /app

# Install dependencies with better error handling
COPY package*.json ./
COPY package-lock.json* ./

# Clear npm cache and install dependencies
RUN npm cache clean --force && \
    npm install

# Copy source code
COPY . .

# Fix permissions - use node user that exists in base image
RUN chown -R node:node /app

# Switch to non-root user that exists in base image
USER node

# Expose port
EXPOSE 5173

# Start development server with host flag
CMD ["npm", "run", "dev", "--", "--host"]