-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (26 loc) · 1.16 KB
/
Copy pathDockerfile
File metadata and controls
33 lines (26 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 基础镜像默认 Docker Hub;国内/弱网拉 registry-1.docker.io 失败时:
# docker build --build-arg BASE_IMAGE=docker.m.daocloud.io/library/python:3.12-slim -t pallasbot:local .
#(镜像站域名以当时可用为准,见 docs/DockerDeployment.md)
ARG BASE_IMAGE=python:3.12-slim
FROM ${BASE_IMAGE}
WORKDIR /app
# CI 传入发版 tag 或 git describe,运行时 /health 的 pallas_bot 优先读此环境变量
ARG PALLAS_BOT_VERSION=
ENV PALLAS_BOT_VERSION=${PALLAS_BOT_VERSION}
# 合并安装依赖,清理缓存,减少镜像层数
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
pip install --upgrade pip && \
pip install uv && \
rm -rf /var/lib/apt/lists/*
COPY pyproject.toml ./
# perf:jieba-next;pg:PostgreSQL 后端
# deploy-shard / message-scrub:见 deploy/README.md
# 构建上下文排除见 .dockerignore;extras 对照见 docs/DockerDeployment.md
ARG PALLAS_UV_EXTRAS=perf,pg
RUN uv pip install --system ".[${PALLAS_UV_EXTRAS}]" --no-cache-dir && \
apt-get purge -y build-essential && \
apt-get autoremove -y && \
rm -rf /root/.cache/pip
COPY . .
CMD ["nb", "run"]