Closed mferon closed 2 years ago
It's currently a bit hard to dev using the docker image as the build is not flexible.
This PR allows to easily build the image on a specific repository/branch by specifying them in the docker-compose ENV.
# Branch config $ grep VERSION .env OPENCVE_VERSION=master # build $ docker-compose build redis uses an image, skipping postgres uses an image, skipping celery_worker uses an image, skipping celery_beat uses an image, skipping Building webserver Sending build context to Docker daemon 126.5kB Step 1/32 : FROM python:3.8-slim-buster as base ---> 60abb4f18941 ..... Step 11/32 : RUN git clone --depth 1 -b v${OPENCVE_VERSION} "${OPENCVE_REPOSITORY}" . || git clone --depth 1 -b ${OPENCVE_VERSION} "${OPENCVE_REPOSITORY}" . ---> Running in a6b687f3471d Cloning into '.'... warning: Could not find remote branch vmaster to clone. fatal: Remote branch vmaster not found in upstream origin Cloning into '.'... ..... Successfully built ab3a44b537a4 Successfully tagged opencve:master # url label $ docker inspect -f '{{.Config.Labels.url}}' opencve:master https://github.com/opencve/opencve.git # Running containers $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3010dae5638d opencve:master "./run.sh celery-wor…" 21 minutes ago Up 21 minutes celery_worker 76bf8e518796 opencve:master "./run.sh webserver …" 21 minutes ago Up 21 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp webserver f8f333dae57f postgres:11 "docker-entrypoint.s…" 21 minutes ago Up 21 minutes 127.0.0.1:5432->5432/tcp postgres 16f79914aecf redis:buster "docker-entrypoint.s…" 21 minutes ago Up 21 minutes 127.0.0.1:6379->6379/tcp redis # Code from last commit $ docker exec webserver grep REPORTS_CLEANUP_DAYS ./venv/lib/python3.8/site-packages/opencve/settings.py REPORTS_CLEANUP_DAYS = config.getint("core", "reports_cleanup_days", fallback=0)
To make it work, the given branch must match docker tag requirement (== no /)
/
It's currently a bit hard to dev using the docker image as the build is not flexible.
This PR allows to easily build the image on a specific repository/branch by specifying them in the docker-compose ENV.
To make it work, the given branch must match docker tag requirement (== no
/
)