# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

# Stage 1: Build the React application using Node.js
# Use Node 20.11.1 as the base image for the build step
FROM node:20.11.1 AS vite-app

WORKDIR /usr/app/react

COPY react /usr/app/react
WORKDIR /usr/app/react


RUN ["npm", "install"]
RUN ["npm", "run", "build"]

FROM nginx:alpine

EXPOSE 80

COPY --from=vite-app /usr/app/react/dist /usr/share/nginx/html
COPY --from=vite-app /usr/app/react/nginx.conf /etc/nginx/conf.d/default.conf

ENTRYPOINT ["nginx", "-g", "daemon off;"]
