I've been trying to integrate a "React" web component for a few days.
Our web component is now hosted in a "Docker" image and exposed on an url. This url therefore does not correspond to the file (.js) of the app, but the complete DOM of the app hosted by nginx web server . We would like to be able to allow different partners to be able to integrate this component easily on a web page.
Unfortunately we cannot find any documentation on this subject.
We would like to avoid the use of an () for various user experiences and slow loading concerns.
Would it be a solution to mount a docker image that would just act as a web file server to simply expose the app's .js file?
What's the best practices ?
Thank you in advance
Here is our Dockerfile
FROM node:14.15.4-alpine3.12 as builder
WORKDIR /app
RUN npm config set registry https://private-repo-url/npm/npm/
RUN npm config set strict-ssl false
COPY package.json .
COPY package-lock.json .
RUN npm install
COPY . .
RUN npm run build
FROM nginx:stable-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
WORKDIR /usr/share/nginx/html
COPY ./config/env.sh .
COPY ./config/.env.*.js ./
# Add bash
RUN apk add --no-cache bash
# Make our shell script executable
RUN chmod +x env.sh
# Start Nginx server
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
Aucun commentaire:
Enregistrer un commentaire