# Stage 1: Build the Angular application
FROM node:alpine AS builder

# Set the working directory
WORKDIR /

# Copy package.json and package-lock.json
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .
COPY dist dist

# Build the application for production
# RUN npm run build:prod

# Stage 2: Serve the application with Nginx
FROM nginx:latest

RUN mkdir /app

# Copy the built application from the builder stage to the Nginx html directory
COPY --from=builder dist/skrill /app

# Copy the custom Nginx configuration file
COPY config/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

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