Skip to content

Commit 45338fa

Browse files
authored
fix: replace the hardcoded /var/www/html by named volume (#2160)
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 904373a commit 45338fa

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

docker-compose.dev.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ services:
1818
- .env
1919
environment:
2020
<<: *dev-env
21-
command: ./manage.py runserver --skip-checks 0.0.0.0:8001
21+
# Skip migrate when the DB schema is already up to date (faster reload)
22+
command: sh -c "
23+
./manage.py migrate --check || ./manage.py migrate;
24+
./manage.py runserver --skip-checks 0.0.0.0:8001"
2225
volumes:
26+
- ./scancodeio:/opt/scancodeio/scancodeio
2327
- ./scanpipe:/opt/scancodeio/scanpipe
2428
ports:
29+
# Port 8001 to avoid conflict when running side-by-side with dejacode on 8000
2530
- "8001:8001"
2631

2732
# Volume mount keeps code in sync. Restart manually with: make restart-worker
@@ -31,10 +36,12 @@ services:
3136
- .env
3237
environment:
3338
<<: *dev-env
34-
command: ./manage.py rqworker --worker-class scancodeio.worker.ScanCodeIOWorker
35-
--queue-class scancodeio.worker.ScanCodeIOQueue
36-
--verbosity 1
39+
command: wait-for-it --strict --timeout=180 web:8001 -- sh -c "
40+
./manage.py rqworker --worker-class scancodeio.worker.ScanCodeIOWorker
41+
--queue-class scancodeio.worker.ScanCodeIOQueue
42+
--verbosity 1"
3743
volumes:
44+
- ./scancodeio:/opt/scancodeio/scancodeio
3845
- ./scanpipe:/opt/scancodeio/scanpipe
3946

4047
# Disable nginx in dev mode, the runserver serves requests directly.

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ services:
7777
./manage.py migrate &&
7878
./manage.py collectstatic --no-input --verbosity 0 --clear &&
7979
gunicorn scancodeio.wsgi:application --bind :8000 --timeout 600 \
80-
--workers 8 ${GUNICORN_RELOAD_FLAG:-}"
80+
--workers 8 --worker-tmp-dir /dev/shm ${GUNICORN_RELOAD_FLAG:-}"
8181
env_file:
8282
- docker.env
8383
expose:
@@ -118,8 +118,8 @@ services:
118118
- "${NGINX_PUBLISHED_HTTPS_PORT:-443}:443"
119119
volumes:
120120
- ./etc/nginx/conf.d/:/etc/nginx/conf.d/
121-
- /var/www/html:/var/www/html
122121
- static:/var/scancodeio/static/
122+
- webroot:/var/www/html/
123123
depends_on:
124124
- web
125125
restart: always
@@ -137,3 +137,4 @@ volumes:
137137
clamav_data:
138138
static:
139139
workspace:
140+
webroot:

0 commit comments

Comments
 (0)