Dockerfile 621 B

1234567891011121314151617181920
  1. FROM node:20 as build-stage
  2. WORKDIR /app
  3. COPY package*.json /app/
  4. RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
  5. && cd /opt/vue-fastapi-admin/web && npm i -g pnpm --registry=https://registry.npmmirror.com \
  6. && pnpm i && pnpm run build
  7. RUN npm install
  8. COPY ./ /app/
  9. ARG VITE_API_URL=${VITE_API_URL}
  10. RUN npm run build
  11. FROM nginx:1
  12. COPY --from=build-stage /app/dist/ /usr/share/nginx/html
  13. COPY ./nginx.conf /etc/nginx/conf.d/default.conf
  14. COPY ./nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf
  15. EXPOSE 80
  16. VOLUME [ "/usr/share/nginx/html" ]