Add makefile for docker commands (#43)

* Create makefile

* Update readme with makefile commands

* Update readme spacing and sh comments

* Add back line that was taken out in readme

* stop and down rename in makefile

* Updates as per feedback

* Update readme to include raw docker commands as well as makefile ones
pull/44/head
Steve Stein 2022-05-12 03:21:47 -06:00 zatwierdzone przez GitHub
rodzic a19af88852
commit 75a90827d9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 142 dodań i 1 usunięć

44
Makefile 100644
Wyświetl plik

@ -0,0 +1,44 @@
.PHONY: help
.DEFAULT_GOAL := help
help: ## ⁉️ - Display help comments for each make command
@grep -E '^[0-9a-zA-Z_-]+:.*? .*$$' \
$(MAKEFILE_LIST) \
| awk 'BEGIN { FS=":.*?## " }; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' \
| sort
build: ## Build the backend Docker image
docker-compose build web
start: ## Bring the backend Docker container up
docker-compose up
stop: ## Stop the backend Docker container
docker-compose stop
ssh: ## Enter the running backend Docker container for the wagtail bakery site
docker-compose exec web bash
ssh-shell: ## Enter the running Docker container shell
docker-compose exec web python manage.py shell
ssh-fe: ## Open a shell to work with the frontend code (Node/NPM)
docker-compose exec frontend bash
ssh-wagtail: ## Enter the running Docker container for the wagtail development environment
docker-compose exec -w /code/wagtail web bash
ssh-db: ## Open a PostgreSQL shell session
docker-compose exec web python manage.py dbshell
down: ## Stop and remove all Docker containers
docker-compose down
migrations: ## Make migrations to the wagtail bakery site
docker-compose exec web python manage.py makemigrations
migrate: ## Migrate the wagtail bakery site migrations
docker-compose exec web python manage.py migrate
test: ## Run all wagtail tests or pass in a file with `make test file=wagtail.admin.tests.test_name.py`
docker-compose exec -w /code/wagtail web python runtests.py $(FILE)

Wyświetl plik

@ -86,36 +86,133 @@ frontend docker-entrypoint.sh /bin/ ... Up
web ./manage.py runserver 0.0. ... Up 0.0.0.0:8000->8000/tcp
```
### Build the backend Docker image
```sh
make build
```
or
```sh
docker-compose build web
```
### Bring the backend Docker container up
```sh
make start
```
or
```sh
docker-compose up
```
### Stop all Docker containers
```sh
make stop
```
or
```sh
docker-compose stop
```
### Stop all and remove all Docker containers
```sh
make down
```
or
```sh
docker-compose down
```
### Run tests
```sh
make test
```
or
```sh
docker-compose exec -w /code/wagtail web python runtests.py
```
### Run tests for a specific file
```sh
make test file=wagtail.admin.tests.test_name.py
```
or
```sh
docker-compose exec -w /code/wagtail web python runtests.py wagtail.admin.tests.{test_file_name_here}.py
```
### Open a Django shell session
```sh
make ssh-shell
```
or
```sh
docker-compose exec web python manage.py shell
```
### Open a PostgreSQL shell session
```sh
make ssh-db
```
or
```sh
docker-compose exec web python manage.py dbshell
```
### Open a shell on the web server
```sh
make ssh
```
or
```sh
docker-compose exec web bash
```
### Open a shell to work with the frontend code (Node/NPM)
```sh
make ssh-fe
```
or
```sh
docker-compose exec frontend bash
```
### Open a shell to work within the wagtail container
```sh
make ssh-fe
```
or
```sh
docker-compose exec -w /code/wagtail web bash
```
### Make migrations to the wagtail bakery site
```sh
make migrations
```
or
```sh
docker-compose exec web python manage.py makemigrations
```
### Migrate the wagtail bakery site
```sh
make migrate
```
or
```sh
docker-compose exec web python manage.py migrate
```
Getting ready to contribute
---------------------------