AirShelf/core/frontend/Dockerfile
zyc d41e487f08
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m40s
feat(k8s): 新增 core 真应用(前端+Django API+Celery worker)构建与部署
- core/frontend: Vite 多阶段镜像 + nginx 同源反代 /api,/admin,/static(零 CORS)
- core/backend: Django gunicorn 镜像 + entrypoint(自动 migrate/collectstatic)+ WhiteNoise
- k8s/core: api/worker/web Deployment+Service + ingress(airshelf-web.airlabs.art)
- workflow: 追加 core 前后端 build/push,从 core/backend/.env 套生产覆盖生成 env Secret 后部署
- .gitignore 放行 core/backend/.env;.env 白名单加入 airshelf-web 域名
- 含前端 WIP 还原改动

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 10:21:41 +08:00

28 lines
779 B
Docker

# ---- Stage 1: build the React/Vite SPA ----
FROM docker.m.daocloud.io/node:20-alpine AS build
WORKDIR /app
# npm registry mirror for CN runners
RUN npm config set registry https://registry.npmmirror.com
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# VITE_API_BASE_URL is empty => the SPA calls /api on the same origin,
# which nginx (below) proxies to the backend service. Zero CORS.
ENV VITE_API_BASE_URL=""
RUN npm run build
# ---- Stage 2: serve static + reverse-proxy /api to backend ----
FROM docker.m.daocloud.io/nginx:alpine
RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]