Created
February 1, 2022 20:45
-
-
Save carlohcs/c9a59ad2f7dc22c4bb708b3b7684d509 to your computer and use it in GitHub Desktop.
Build an image docker with static react application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build environment | |
FROM node:13.12.0-alpine as builder | |
WORKDIR /app | |
ENV PATH /app/node_modules/.bin:$PATH | |
COPY package.json ./ | |
COPY package-lock.json ./ | |
RUN npm ci --silent | |
RUN npm install [email protected] -g --silent | |
COPY . ./ | |
RUN npm run build | |
# production environment | |
FROM nginx:stable-alpine | |
COPY --from=builder /app/build /usr/share/nginx/html | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment