39 lines
1009 B
Docker
39 lines
1009 B
Docker
|
# 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@git.io8.dev/risadmin_prod/prod112rb.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/prod112rb/prod112rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/ .
|
||
|
RUN npm install --force
|
||
|
RUN npm install --force html2canvas
|
||
|
RUN PUBLIC_URL=http://13.200.171.124:30345/prod112rb24520/front 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;"]
|