Cache test image to speed up CI backend test step
Add a 'test' stage to Dockerfile that extends runtime-base with the venv and test dependencies (pytest, fakeredis, etc.) pre-installed. Drone CI now builds and caches this image as :test, then uses it directly for running tests — eliminating apt-get and pip install on every build.
This commit is contained in:
parent
909cb8e04b
commit
96bcebdb40
2 changed files with 28 additions and 5 deletions
21
.drone.yml
21
.drone.yml
|
|
@ -109,12 +109,25 @@ trigger:
|
|||
- push
|
||||
|
||||
steps:
|
||||
- name: Cache test image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username: viktorbarzin
|
||||
password:
|
||||
from_secret: dockerhub-token
|
||||
repo: viktorbarzin/realestatecrawler
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
target: test
|
||||
cache_from:
|
||||
- viktorbarzin/realestatecrawler:test
|
||||
- viktorbarzin/realestatecrawler:builder
|
||||
tags:
|
||||
- test
|
||||
|
||||
- name: Run backend tests
|
||||
image: python:3.13-slim
|
||||
image: viktorbarzin/realestatecrawler:test
|
||||
commands:
|
||||
- apt-get update && apt-get install -y --no-install-recommends gcc libmariadb-dev pkg-config python3-dev build-essential libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
|
||||
- pip install --no-cache-dir -r requirements.txt
|
||||
- pip install --no-cache-dir pytest pytest-asyncio pytest-xdist httpx aioresponses fakeredis
|
||||
- pytest tests/ -x -q
|
||||
|
||||
- name: Cache builder stage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue