aura-web/Dockerfile

16 lines
469 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 前端构建Vite 静态产物 → nginx 提供
FROM node:20-alpine AS builder
WORKDIR /src
COPY package.json package-lock.json* ./
RUN npm ci || npm install
COPY . ./
# 后端在 docker 网络中通过服务名 server 访问compose 里)
ARG VITE_API_TARGET=http://server:4001
ENV VITE_API_TARGET=$VITE_API_TARGET
RUN npm run build
FROM nginx:alpine
COPY --from=builder /src/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80