'How to use Let's Encrypt with Nginx running inside Docker

I dockerise a React application for production. I added Nginx has the server inside Docker. my Dockerfile below:

FROM node:14-alpine AS builder
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build


FROM nginx:alpine AS server

WORKDIR /usr/share/nginx/html
COPY --from=builder ./app/build .

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

How do I create TLS certificate for this application using Let's Encrypt? Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source