Skip to content

Commit

Permalink
add testing to docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
larsrinn committed Jun 6, 2021
1 parent c61724e commit 36cfd7c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,18 @@ services:
profiles:
- update

test:
container_name: ops-test
build: .
environment:
- TESTING=True
volumes:
- ./osm:/deploy/app/osm
- ./osm_test:/deploy/app/osm_test
- ./ops_settings_docker.yml:/deploy/app/openpoiservice/server/ops_settings.yml
- ./categories_docker.yml:/deploy/app/openpoiservice/server/categories/categories.yml
depends_on:
- db
mem_limit: 8g
networks:
- poi_network
14 changes: 9 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh
if [[ ! -z "$UPDATE_DB" ]]; then
echo "Updating POI database"
/ops_venv/bin/python manage.py import-data
python manage.py import-data
elif [[ ! -z "$INIT_DB" ]]; then
echo "Initializing POI database"
/ops_venv/bin/python manage.py drop-db
/ops_venv/bin/python manage.py create-db
/ops_venv/bin/python manage.py import-data
python manage.py drop-db
python manage.py create-db
python manage.py import-data
elif [[ ! -z "$TESTING" ]]; then
echo "Running tests"
export TESTING="True"
python manage.py test
else
/ops_venv/bin/gunicorn --config /deploy/gunicorn_config.py manage:app
gunicorn --config gunicorn_config.py manage:app
fi

0 comments on commit 36cfd7c

Please sign in to comment.