Last active
May 4, 2019 06:31
-
-
Save matthewoestreich/1150f8df652a11da294fd4b5857013bf to your computer and use it in GitHub Desktop.
Docker and NGINX for Vue History Mode
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /usr/share/nginx/html; | |
index index.html; | |
location / { | |
# Support the HTML5 History mode of the vue-router. | |
# https://router.vuejs.org/en/essentials/history-mode.html | |
try_files $uri $uri/ /index.html; | |
} | |
} |
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:lts-alpine AS build-stage | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
RUN npm run build | |
# production stage | |
# - this line was throwing errors, something is up with Jenkins Docker plugin - | |
# FROM nginx:stable-alpine as production-stage | |
FROM nginx:stable-alpine | |
#### THIS LINE! YOU ALSO NEED THE NGINX CONF FILE | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
COPY --from=build-stage /app/docs /usr/share/nginx/html | |
EXPOSE 80:1337 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment