Created
May 8, 2021 06:08
-
-
Save xinyii/ad6568276ffd3500a4f7e08d389557ad to your computer and use it in GitHub Desktop.
[Docker deploy front-end] #docker
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
FROM node:alpine as builder | |
WORKDIR /usr/src/app | |
COPY package.json ./ | |
RUN yarn install | |
ADD src ./src | |
ADD *.json ./ | |
ADD *.conf.js ./ | |
ADD e2e ./e2e | |
RUN yarn run build | |
FROM nginx:alpine | |
COPY --from=builder /usr/src/app/dist /usr/share/nginx/html | |
RUN chmod -R 777 /usr/share/nginx/html/* | |
COPY nginx.conf /etc/nginx/conf.d/default.conf |
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
server { | |
listen 80; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html; | |
try_files $uri $uri/ /index.html; | |
} | |
location /api { | |
proxy_pass http://server:8080; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment