I have application in Django. Requirements consist of many libraries. After linting stage in Gitlab CI I would like to run some tests I wrote. To be able to run Postgres and Django I have to install requirements, it take some time.
Is there some easy way how to cache that image with all installed requirements or I have to install it all again every time I want to run that tests? It is impractical according to me.
I could have job before test where I would build my custom image based on requirements and image I build last time, as cache image. I could keep custom image in personal registry and use it in next job with tests.
linting --> build_job_image --> tests --> staging --> production
It looks like better way than install it every time, but still not the best idea.
I am new with DevOps so I am trying to find the best way, don't know what is the best practice.
I am using python:3.7-alpine image for this job.
I solved this issue with gitlab cache :
During next run everything is much faster, because more of requirements packages are already installed.
Second option mentioned by Zeitounator is also a way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.