| 
									
										
										
										
											2025-06-18 06:51:36 +00:00
										 |  |  | # Use a multi-stage build
 | 
					
						
							|  |  |  | FROM farhan23432/ris_git:2.30.1 AS code
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Set build arguments and labels
 | 
					
						
							|  |  |  | ARG BUILD_ID
 | 
					
						
							|  |  |  | RUN echo $BUILD_ID
 | 
					
						
							|  |  |  | LABEL stage=builder | 
					
						
							|  |  |  | LABEL build_id=$BUILD_ID
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Clone repository and copy React.js code
 | 
					
						
							|  |  |  | RUN mkdir /repo
 | 
					
						
							|  |  |  | WORKDIR /repo
 | 
					
						
							|  |  |  | RUN git clone http://$GITEA_USER:$GITEA_PASS@157.66.191.31:3000/risadmin_prod/test44rb.git
 | 
					
						
							|  |  |  | COPY . .
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Use a multi-stage build
 | 
					
						
							|  |  |  | FROM node:14-alpine AS builder
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Set working directory
 | 
					
						
							|  |  |  | WORKDIR /app
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Copy React.js code and install dependencies
 | 
					
						
							|  |  |  | COPY --from=code /repo/test44rb/test44rb-front-f/Authsec_ReactBootStrapNew/ .
 | 
					
						
							|  |  |  | # Clear everything and do a fresh install
 | 
					
						
							|  |  |  | RUN rm -rf node_modules && \
 | 
					
						
							|  |  |  |     rm -rf package-lock.json && \
 | 
					
						
							|  |  |  |     npm cache clean --force
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install html2canvas first with exact version
 | 
					
						
							|  |  |  | RUN npm install html2canvas@1.4.1 --save-exact --no-package-lock
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install all other dependencies
 | 
					
						
							|  |  |  | RUN npm install --force --legacy-peer-deps
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Verify the package is installed
 | 
					
						
							|  |  |  | RUN ls -la node_modules/html2canvas && \
 | 
					
						
							|  |  |  |     ls -la node_modules/html2canvas/dist
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Set environment variables
 | 
					
						
							| 
									
										
										
										
											2025-06-18 09:07:03 +00:00
										 |  |  | ENV PUBLIC_URL=http://157.66.191.31:35048/test44rb40124/front
 | 
					
						
							| 
									
										
										
										
											2025-06-18 06:51:36 +00:00
										 |  |  | ENV NODE_PATH=/app/node_modules
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Run build
 | 
					
						
							|  |  |  | RUN npm run build
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Use Nginx as the web server
 | 
					
						
							|  |  |  | FROM nginx:alpine
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Copy build artifacts from the previous stage to serve React.js application
 | 
					
						
							|  |  |  | COPY --from=builder /app/build /usr/share/nginx/html
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Expose port 80
 | 
					
						
							|  |  |  | EXPOSE 80
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Start Nginx when the container runs
 | 
					
						
							|  |  |  | CMD ["nginx", "-g", "daemon off;"]
 |