# Git clone
FROM alpine/git:v2.30.1 AS code
ARG BUILD_ID
ARG GITEA_USER
ARG GITEA_PASS
RUN echo $BUILD_ID
LABEL stage=builder
LABEL build_id=$BUILD_ID
RUN mkdir repo
WORKDIR /repo
RUN git clone http://$GITEA_USER:$GITEA_PASS@157.66.191.31:3000/risadmin_prod/hm4.git
# angular build
FROM node:16.20.2-alpine3.18 as build
LABEL stage=app
LABEL build_id=$BUILD_ID
WORKDIR /usr/src/app
COPY --from=code /repo/hm4/hm4-front-f/authsec_angular/frontend/angular-clarity-master/package.json /repo/hm4/hm4-front-f/authsec_angular/frontend/angular-clarity-master/package-lock.json ./
RUN npm install
COPY --from=code /repo/hm4/hm4-front-f/authsec_angular/frontend/angular-clarity-master .
ENV NODE_OPTIONS="--max_old_space_size=4096"
RUN npm run build

# configuring nginx web-server

FROM nginx:1.17.1-alpine
#COPY --from=code /repo/cns-beta/springboot/angular-clarity-master/angular-clarity-master/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
#RUN ls -a /usr/share/nginx/html/
EXPOSE 80
   