FROM node:24.0.0 AS build
RUN mkdir -p /app
WORKDIR /app

COPY ["./*.json", "./"]

RUN npm install -g @angular/cli

COPY . .
# Run command in Virtual directory
RUN npm cache clean --force

RUN npm install

#RUN ng build --configuration=production
RUN ng build -c=production

FROM nginx:latest
#### copy nginx conf
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

#COPY --from=build app/dist/Familytree/browser /usr/share/nginx/html
#### copy artifact build from the 'build environment' old is not in browser folder
COPY --from=build /app/dist/Familytree/browser /usr/share/nginx/html

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

EXPOSE 80

#docker build -t my_angular_app:latest .
#docker run --name carval -d -p 4200:80 varlidate_ui
#npm error code ENOENT