This commit is contained in:
Sakurasan
2026-07-06 01:01:38 +08:00
parent 084eb146f9
commit 0719c63ef1
7 changed files with 149 additions and 194 deletions
+17 -11
View File
@@ -1,17 +1,23 @@
# ---- Build stage ----
FROM node:22-alpine AS build
# ---- Frontend build ----
FROM node:22-alpine AS frontend-build
WORKDIR /app
COPY . .
COPY package.json pnpm-lock.yaml .npmrc ./
RUN corepack enable && corepack prepare pnpm@10 --activate && pnpm install
COPY . .
RUN pnpm build
# ---- Serve stage ----
FROM nginx:alpine
# ---- Backend runtime ----
FROM python:3.11-slim
WORKDIR /app
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN apt-get update && apt-get install -y --no-install-recommends gcc \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 3015
CMD ["nginx", "-g", "daemon off;"]
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/ .
COPY --from=frontend-build /app/dist ./dist
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]