randoz

Makefile

Jun 30th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.78 KB | None | 0 0
  1. .PHONY: vars env
  2. .SILENT: vars swarm
  3.  
  4. COMPOSE := docker-compose -f local.yml
  5.  
  6. # Variables
  7. PIP := ./env/bin/pip
  8. PYTHON := ./env/bin/python
  9. # make target FOO=bar
  10. APP=
  11.  
  12. help:
  13.     @echo
  14.     @echo ----------------------------------------------------------------------
  15.     @echo "   Development commands file                                        "
  16.     @echo ----------------------------------------------------------------------
  17.     @echo
  18.     @echo " - docker                    Run docker as daemon for set IDEs like PyCharm"
  19.     @echo " - build                     Build the containers for development"
  20.     @echo " - server                    Server up"
  21.     @echo " - superuser                 Create a superuser in development"
  22.     @echo " - migrationn APP={app}      Create migrations from project"
  23.     @echo " - migrate                   Apply migrations from project"
  24.     @echo " - flushdb                   Flush Database"
  25.     @echo " - backupdb                  Backing Up DB"
  26.     @echo " - backups                   List backups"
  27.     @echo
  28.     @echo ----------------------------------------------------------------------
  29.  
  30. docker:
  31.     @echo "Running docker socket..."
  32.     socat -d -d TCP-L:8099,fork UNIX:/var/run/docker.sock &
  33.  
  34. build:
  35.     $(COMPOSE) build
  36.     @echo "Building..."
  37.  
  38. server:
  39.     @echo "Server up..."
  40.     $(COMPOSE) up
  41.  
  42. django:
  43.     @echo "Server for debbugging..."
  44.     $(COMPOSE) run --service-ports django
  45.  
  46.  
  47. superuser:
  48.     @echo "Creating superuser..."
  49.     $(COMPOSE) run django python manage.py createsuperuser
  50.  
  51. migrate:
  52.     @echo "Applying migrations ..."
  53.     $(COMPOSE) run django python manage.py migrate
  54.  
  55. migrations:
  56.     @echo "Creating migrations ..."
  57.     $(COMPOSE) run django python manage.py makemigrations $(APP)
  58.  
  59. settings:
  60.     $(COMPOSE) run django python manage.py diffsettings
  61.  
  62. flushdb:
  63.     @echo "Flushing database ..."
  64.     $(COMPOSE) run django python manage.py flush
Advertisement
Add Comment
Please, Sign In to add comment