fix(ci): store requirements.txt under /app not /tmp
DinD legacy builder does not persist /tmp across RUN steps, so uv pip install could not find requirements.txt on the next layer.
This commit is contained in:
parent
1ac39da511
commit
3a7fe235b1
2 changed files with 8 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ jobs:
|
||||||
export PATH="${HOME}/bin:${PATH}"
|
export PATH="${HOME}/bin:${PATH}"
|
||||||
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${REGISTRY_USER}" --password-stdin
|
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${REGISTRY_USER}" --password-stdin
|
||||||
IMAGE="${REGISTRY}/${IMAGE_NAME}"
|
IMAGE="${REGISTRY}/${IMAGE_NAME}"
|
||||||
docker build --build-arg DEPS_LOCK_ID=3 -f buildctx/Dockerfile.ci \
|
docker build --build-arg DEPS_LOCK_ID=4 -f buildctx/Dockerfile.ci \
|
||||||
-t "${IMAGE}:latest" -t "${IMAGE}:main-${SHORT}" buildctx
|
-t "${IMAGE}:latest" -t "${IMAGE}:main-${SHORT}" buildctx
|
||||||
docker push "${IMAGE}:latest"
|
docker push "${IMAGE}:latest"
|
||||||
docker push "${IMAGE}:main-${SHORT}"
|
docker push "${IMAGE}:main-${SHORT}"
|
||||||
|
|
|
||||||
13
Dockerfile
13
Dockerfile
|
|
@ -14,7 +14,7 @@ RUN apt-get update \
|
||||||
COPY pyproject.toml ./
|
COPY pyproject.toml ./
|
||||||
|
|
||||||
# Bump DEPS_LOCK_ID when dependency wiring changes (busts DinD layer cache).
|
# Bump DEPS_LOCK_ID when dependency wiring changes (busts DinD layer cache).
|
||||||
ARG DEPS_LOCK_ID=3
|
ARG DEPS_LOCK_ID=4
|
||||||
RUN echo "deps-lock=${DEPS_LOCK_ID}" && python - <<'PY'
|
RUN echo "deps-lock=${DEPS_LOCK_ID}" && python - <<'PY'
|
||||||
import sys
|
import sys
|
||||||
import tomllib
|
import tomllib
|
||||||
|
|
@ -36,21 +36,22 @@ lines = [
|
||||||
if not lines:
|
if not lines:
|
||||||
sys.exit("no installable dependencies after filter")
|
sys.exit("no installable dependencies after filter")
|
||||||
|
|
||||||
Path("/tmp/requirements.txt").write_text("\n".join(lines) + "\n", encoding="utf-8")
|
req_path = Path("/app/requirements.txt")
|
||||||
if Path("/tmp/requirements.txt").stat().st_size == 0:
|
req_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||||
|
if req_path.stat().st_size == 0:
|
||||||
sys.exit("requirements.txt is empty")
|
sys.exit("requirements.txt is empty")
|
||||||
print(f"wrote {len(lines)} requirements")
|
print(f"wrote {len(lines)} requirements to {req_path}")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
RUN uv venv /app/.venv \
|
RUN uv venv /app/.venv \
|
||||||
&& uv pip install --python /app/.venv/bin/python --no-cache -r /tmp/requirements.txt
|
&& uv pip install --python /app/.venv/bin/python --no-cache -r /app/requirements.txt
|
||||||
|
|
||||||
COPY --from=hub_core_src pyproject.toml /tmp/hub-core/pyproject.toml
|
COPY --from=hub_core_src pyproject.toml /tmp/hub-core/pyproject.toml
|
||||||
COPY --from=hub_core_src hub_core/ /tmp/hub-core/hub_core/
|
COPY --from=hub_core_src hub_core/ /tmp/hub-core/hub_core/
|
||||||
|
|
||||||
RUN uv pip install --python /app/.venv/bin/python --no-cache /tmp/hub-core
|
RUN uv pip install --python /app/.venv/bin/python --no-cache /tmp/hub-core
|
||||||
|
|
||||||
RUN test -s /tmp/requirements.txt \
|
RUN test -s /app/requirements.txt \
|
||||||
&& /app/.venv/bin/python -c "import asyncpg"
|
&& /app/.venv/bin/python -c "import asyncpg"
|
||||||
|
|
||||||
COPY alembic.ini ./
|
COPY alembic.ini ./
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue