Prerequisites are installing docker and docker-compose.
$ docker-compose up
$ docker-compose up
When you are making changes to the data model, you have to generate the migration files
docker-compose up
docker-compose exec backend python3 src/manage.py makemigrations
docker build -t veritus/backend:latest .
docker-compose up
Sometimes you need to take some actions during the migrate
command (you will see it in the console when running docker-compose).
Then simply run
docker-compose up
and then in another terminal window run
docker-compose exec backend python3 src/manage.py migrate
To run tests manually then simply run
docker-compose up
and then in another terminal window run
docker-compose exec backend python3 src/manage.py test
To run tests manually then simply run
docker-compose up
and then in another terminal window run
docker-compose exec backend pylint src/**
docker-compose up
and then in another terminal window run
docker-compose exec backend autopep8 --in-place --recursive .
The docker image here is NOT supposed to be run alone. As the backend requires a database, there is no use running it alone. Use docker-compose to run the backend and database together.
Builds a local image of the project with the tag latest
.
docker build -t veritus/backend:latest .
This is automatically done by Docker Cloud in the build process and saved in the Docker image repository online.
docker login
Input credentials.
You normally dont have to do this manually as the build process takes care of it.
docker push <IMAGE-NAME>:</TAG>
Example:
docker push veritus/backend:latest
Docker compose can be used here to start the backend with a database. Simply run
$ docker-compose up
It also works to use this during development, as docker-compose mounts the source code directory into the docker container when run. Meaning you simply need to rerun
docker-compose up
after making code changes.
Run this to get the id of the docker container
$ docker ps
Then run this command to get the IP address of the container (should be close to the bottom)
$ docker inspect <id>
Then open pgAdmin
docker-compose exec backend python3 src/manage.py runcrons