# build stage
# Use an official node runtime as a parent image
FROM node:bullseye-slim AS build-stage

# Set the working directory to /app
WORKDIR /app

# Copy the code into the container
COPY ./ /app

# Install any dependencies specified
RUN npm install

RUN npm run build -- --mode production

# production stage

FROM nginx:stable-alpine AS production-stage

COPY --from=build-stage /app/dist /usr/share/nginx/html

# Expose port 8080
EXPOSE 80

# Run the Python script that provides the Flask API
CMD ["nginx", "-g", "daemon off;"]
