Created
June 17, 2020 20:29
-
-
Save sandiprb/399285f9beb0d1b3df445979e9abc1f8 to your computer and use it in GitHub Desktop.
Deploy React / Vue / Front-end node projects with nginx Docker image
This file contains 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
# Use a lighter version of Node as a parent image | |
FROM node:10 as project-build | |
# Set the working directory to /frontend | |
WORKDIR /project | |
COPY package*.json /project/ | |
RUN npm install | |
COPY . /project/ | |
RUN npm run build # replace this if your project uses a diffrent build command | |
FROM nginx:alpine | |
COPY --from=project-build /project/build/ /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
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