feat: 增加 Metrix 应用包打包脚本并完善容器镜像
This commit is contained in:
+10
-4
@@ -2,19 +2,25 @@ ARG NODE_IMAGE=node:22-bookworm-slim
|
||||
ARG PYTHON_IMAGE=python:3.13-slim
|
||||
|
||||
FROM ${NODE_IMAGE} AS web
|
||||
ARG NPM_REGISTRY=
|
||||
WORKDIR /src
|
||||
COPY web/package.json web/package-lock.json ./
|
||||
RUN npm ci
|
||||
RUN if [ -n "$NPM_REGISTRY" ]; then npm config set registry "$NPM_REGISTRY"; fi \
|
||||
&& npm ci --no-audit --no-fund
|
||||
COPY web/ .
|
||||
RUN npm run build
|
||||
|
||||
FROM ${PYTHON_IMAGE}
|
||||
ARG PIP_INDEX=
|
||||
WORKDIR /app
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
DECOM_INLINE_WORKER=0
|
||||
COPY backend/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN if [ -n "$PIP_INDEX" ]; then pip install --no-cache-dir --index-url "$PIP_INDEX" -r requirements.txt; \
|
||||
else pip install --no-cache-dir -r requirements.txt; fi
|
||||
COPY backend/ .
|
||||
COPY --from=web /src/dist ./web/dist
|
||||
EXPOSE 8000
|
||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--forwarded-allow-ips", "*"]
|
||||
|
||||
Reference in New Issue
Block a user