- Clone the repository:
$ git clone https://github.com/vladkoblynsky/shop.git
-
We are using shared folders to enable live code reloading. Without this, Docker Compose will not start:
- Windows/MacOS: Add the cloned
shop
directory to Docker shared directories (Preferences -> Resources -> File sharing). - Windows/MacOS: Make sure that in Docker preferences you have dedicated at least 5 GB of memory (Preferences -> Resources -> Advanced).
- Linux: No action required, sharing already enabled and memory for Docker engine is not limited.
- Windows/MacOS: Add the cloned
-
Go to the cloned directory:
$ cd shop
- Build the application:
$ docker-compose -f dev.yml build
- Apply Django migrations:
$ docker-compose run --rm api python3 manage.py migrate
- Collect static files:
$ docker-compose run --rm api python3 manage.py collectstatic --noinput
- Create the admin user:
$ docker-compose run --rm api python3 manage.py createsuperuser
- Run the application:
$ docker-compose -f dev.yml up
Create db backup: docker exec ${container} pg_dump -U ${username} -d ${dbname} > ${backup_file}
Restore db: docker exec -i ${container} psql -U ${username} -d ${dbname} < ${backup_file}