Created
May 17, 2021 03:02
-
-
Save thinhbuzz/26b2b8481711ee760b4fb5ee8645a1a0 to your computer and use it in GitHub Desktop.
build docker image for 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
FROM node:14-alpine3.10 AS builder | |
WORKDIR /usr/src/app | |
ARG API_ENDPOINT=http://localhost:3333/api | |
ENV REACT_APP_API_ENDPOINT=$API_ENDPOINT | |
COPY package*.json ./ | |
RUN npm ci | |
COPY . . | |
RUN npm run build | |
FROM nginx:1.20-alpine | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
COPY --from=builder /usr/src/app/build /usr/share/nginx/html | |
EXPOSE 80 | |
# Launch NGINX | |
CMD [ "nginx", "-g", "daemon off;" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment