perf: optimize CI pipeline — eliminate double dependency installs, use local registry cache
- Frontend Dockerfile: split into deps/test/builder/nginx stages so npm ci runs once (cached when package-lock.json unchanged), tests run in build - Backend Dockerfile: add test stage that runs pytest inside the build, eliminating separate test image build - .drone.yml: remove separate test steps (now inside Dockerfile builds), point cache_from/cache_repo at local registry (10.0.20.10:5000) instead of Docker Hub for faster layer cache pulls
This commit is contained in:
parent
68859ae577
commit
b1be4d4170
3 changed files with 68 additions and 49 deletions
|
|
@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
libmariadb3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Stage 3: Test image — runtime deps + venv + test dependencies
|
||||
# Stage 3: Test — runtime deps + venv + test dependencies + run tests
|
||||
FROM runtime-base AS test
|
||||
|
||||
WORKDIR /app
|
||||
|
|
@ -38,6 +38,10 @@ ENV PATH="/app/.venv/bin:$PATH"
|
|||
|
||||
RUN pip install --no-cache-dir pytest pytest-asyncio pytest-xdist httpx aioresponses fakeredis
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN pytest tests/ -x -q
|
||||
|
||||
# Stage 4: Final image — combine venv from builder + runtime base
|
||||
FROM runtime-base
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue