Add example dockerfiles for React app
This commit is contained in:
24
dockerfile-examples/react/react-app/Dockerfile.correct
Normal file
24
dockerfile-examples/react/react-app/Dockerfile.correct
Normal file
@ -0,0 +1,24 @@
|
||||
FROM node:lts-alpine AS base
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
RUN yarn install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN 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;"]
|
||||
|
Reference in New Issue
Block a user