Add example dockerfiles for React app

This commit is contained in:
Mike Conrad
2025-05-03 21:16:41 -04:00
parent a2e5374aba
commit 486aa9af7c
20 changed files with 2480 additions and 0 deletions

View File

@ -0,0 +1,23 @@
FROM node:lts-alpine AS base
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY . .
RUN yarn install && \
yarn build
FROM nginx:alpine AS serve
WORKDIR /usr/share/nginx/html
COPY --from=base /app/dist .
EXPOSE 80
# Demonstrate the difference between CMD and Entrypoint
# Running image with cmd defined will override the command the container runs
# Whereas entrypoint, any command you add will be appended
CMD ["nginx", "-g", "daemon off;"]
# ENTRYPOINT ["nginx", "-g", "daemon off;"]