FROM node:22-alpine AS build

WORKDIR /app

COPY package.json package-lock.json ./

# Install dependencies
RUN npm install 


# Copy source code
COPY . .

RUN npm run build

# Production stage
FROM nginx:alpine

# Copy built files to nginx
COPY --from=build /app/dist /usr/share/nginx/html

# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf

# Expose port
EXPOSE 80

# Start nginx
CMD ["nginx", "-g", "daemon off;"] 
