|
@@ -50,13 +50,21 @@ RUN set -ex && \
|
|
|
apt-get clean && \
|
|
apt-get clean && \
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
+# 从官方镜像拷贝 uv 二进制
|
|
|
|
|
+COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
|
+
|
|
|
|
|
+# 先安装依赖(利用 Docker 层缓存)
|
|
|
COPY pyproject.toml uv.lock ./
|
|
COPY pyproject.toml uv.lock ./
|
|
|
-RUN pip install --no-cache-dir uv && \
|
|
|
|
|
- uv pip install --system --frozen --no-cache && \
|
|
|
|
|
- pip uninstall -y uv
|
|
|
|
|
|
|
+RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
|
+ uv sync --locked --no-install-project --no-dev
|
|
|
|
|
|
|
|
|
|
+# 再复制项目代码并安装项目本身
|
|
|
COPY docker/manage.py .
|
|
COPY docker/manage.py .
|
|
|
COPY trendradar/ ./trendradar/
|
|
COPY trendradar/ ./trendradar/
|
|
|
|
|
+RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
|
|
+ uv sync --locked --no-dev
|
|
|
|
|
+
|
|
|
|
|
+ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
|
|
|
|
# 复制 entrypoint.sh 并强制转换为 LF 格式
|
|
# 复制 entrypoint.sh 并强制转换为 LF 格式
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh.tmp
|
|
COPY docker/entrypoint.sh /entrypoint.sh.tmp
|