first commit
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
FROM node:16-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
RUN npm config set registry https://registry.npmmirror.com \
|
||||
&& npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# 线上服务沿用原有的 5000 端口;同时为 Vue 单页应用补充路由回退,避免刷新子路由时返回 404。
|
||||
RUN sed -i -E 's/listen[[:space:]]+80;/listen 5000;/' /etc/nginx/conf.d/default.conf \
|
||||
&& sed -i '/index index.html index.htm;/a\ try_files $uri $uri/ /index.html;' /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user