Move uv sync into the same RUN as curl installer
The install script places uv in /usr/local/bin/uv but doesn't modify the shell's PATH for subsequent RUN layers. Moving uv sync into the same RUN so the freshly installed binary is immediately usable. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
+3
-5
@@ -49,7 +49,7 @@ CMD ["python", "main.py", "admin"]
|
|||||||
|
|
||||||
FROM oci.reg.darano.ir/mcr.microsoft.com/playwright:v1.62.0-noble AS worker
|
FROM oci.reg.darano.ir/mcr.microsoft.com/playwright:v1.62.0-noble AS worker
|
||||||
|
|
||||||
# Install Python 3.12 + uv (the Playwright image has browsers but no Python).
|
# Install Python 3.12 + uv, then sync deps — all in one RUN so PATH is consistent.
|
||||||
# Use a mirror for apt since the VPS has network restrictions (Iran).
|
# Use a mirror for apt since the VPS has network restrictions (Iran).
|
||||||
# curl is already installed (playwright system dep).
|
# curl is already installed (playwright system dep).
|
||||||
RUN printf 'Types: deb\nURIs: http://repo.iut.ac.ir/ubuntu/\nSuites: noble noble-updates noble-security\nComponents: main restricted universe multiverse\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \
|
RUN printf 'Types: deb\nURIs: http://repo.iut.ac.ir/ubuntu/\nSuites: noble noble-updates noble-security\nComponents: main restricted universe multiverse\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \
|
||||||
@@ -58,7 +58,8 @@ RUN printf 'Types: deb\nURIs: http://repo.iut.ac.ir/ubuntu/\nSuites: noble noble
|
|||||||
python3 python3-venv \
|
python3 python3-venv \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& curl -LsSf https://astral.sh/uv/install.sh | \
|
&& curl -LsSf https://astral.sh/uv/install.sh | \
|
||||||
UV_INSTALL_DIR=/usr/local sh
|
UV_INSTALL_DIR=/usr/local sh \
|
||||||
|
&& /usr/local/bin/uv sync --frozen --no-dev --no-install-project
|
||||||
|
|
||||||
ENV PATH="/app/.venv/bin:$PATH" \
|
ENV PATH="/app/.venv/bin:$PATH" \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
@@ -73,9 +74,6 @@ WORKDIR /app
|
|||||||
# Copy manifests first (stable cache layer)
|
# Copy manifests first (stable cache layer)
|
||||||
COPY pyproject.toml uv.lock* ./
|
COPY pyproject.toml uv.lock* ./
|
||||||
|
|
||||||
# Install project deps into a venv targeting this image's Python 3.12
|
|
||||||
RUN uv sync --frozen --no-dev --no-install-project
|
|
||||||
|
|
||||||
# Copy app code
|
# Copy app code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user