refactor(taskfiles): consolidate start+stop, add namespace for docker tasks
This commit is contained in:
parent
b5b8213be3
commit
35ca5ed377
2 changed files with 23 additions and 13 deletions
|
@ -34,28 +34,23 @@ tasks:
|
|||
cmd: . script/test
|
||||
dotenv:
|
||||
- ../backend-test.env
|
||||
start:
|
||||
lock-deps:
|
||||
desc: "Locks production and development dependencies"
|
||||
deps: [bootstrap]
|
||||
cmd: . script/requirements-lock
|
||||
docker:start:
|
||||
desc: "Starts the backend application."
|
||||
deps: [build]
|
||||
cmd: . script/start.sh
|
||||
dotenv:
|
||||
- ../backend.env
|
||||
stop:
|
||||
docker:stop:
|
||||
desc: "Stops the backend application."
|
||||
cmd: docker rm -f {{ .APP_CONTAINER_NAME }} {{ .DB_CONTAINER_NAME }}
|
||||
logs:
|
||||
docker:logs:
|
||||
desc: "Shortcut to Docker container logs"
|
||||
cmd: docker logs {{ .APP_CONTAINER_NAME }} -f
|
||||
start-db:
|
||||
desc: "Provisions a local Postgres database."
|
||||
dotenv:
|
||||
- ../backend.env
|
||||
cmd: . script/provision-db
|
||||
lock-deps:
|
||||
desc: "Locks production and development dependencies"
|
||||
deps: [bootstrap]
|
||||
cmd: . script/requirements-lock
|
||||
build:
|
||||
docker:build:
|
||||
desc: "Builds a docker image from /backend"
|
||||
cmd: . script/build.sh
|
||||
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker run \
|
||||
--name $DB_CONTAINER_NAME \
|
||||
-e POSTGRES_PASSWORD=$DATABASE_PASSWORD \
|
||||
-e POSTGRES_USER=$DATABASE_USER \
|
||||
-e POSTGRES_DB=$DATABASE_NAME \
|
||||
-v $DATABASE_STORAGE_PATH:/var/lib/postgresql/data \
|
||||
-p 5432:5432 \
|
||||
-d \
|
||||
postgres:15.4
|
||||
|
||||
until [ -n "$(docker exec $DB_CONTAINER_NAME pg_isready | grep accepting)" ]; do
|
||||
echo "Waiting for DB to come alive..."
|
||||
sleep 0.1;
|
||||
done;
|
||||
|
||||
docker run \
|
||||
--detach \
|
||||
--publish 8000:8000 \
|
||||
|
|
Reference in a new issue