refactor(taskfiles): extract start logic out of taskfile
This commit is contained in:
parent
6b49313e3f
commit
0582f9877e
4 changed files with 22 additions and 7 deletions
|
@ -46,8 +46,10 @@ tasks:
|
||||||
start:
|
start:
|
||||||
desc: "Starts the backend application."
|
desc: "Starts the backend application."
|
||||||
deps: [docker-build]
|
deps: [docker-build]
|
||||||
cmd: docker run -d -p 8000:8000 --name {{ .APP_CONTAINER_NAME }} {{ .CLI_ARGS }} --add-host docker.host.internal:host-gateway --env-file ../../backend.env rotini:dev
|
env:
|
||||||
dir: backend/rotini
|
APP_CONTAINER_NAME: "{{ .APP_CONTAINER_NAME }}"
|
||||||
|
cmd: . script/start.sh
|
||||||
|
dir: backend
|
||||||
stop:
|
stop:
|
||||||
desc: "Stops the backend application."
|
desc: "Stops the backend application."
|
||||||
cmd: docker rm -f {{ .APP_CONTAINER_NAME }}
|
cmd: docker rm -f {{ .APP_CONTAINER_NAME }}
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
DJANGO_SECRET_KEY="notakey"
|
DJANGO_SECRET_KEY="notakey"
|
||||||
JWT_SIGNING_SECRET="notasecret"
|
JWT_SIGNING_SECRET="notasecret"
|
||||||
|
DB_HOST="rotini_db"
|
||||||
|
DB_USER="postgres"
|
||||||
|
DB_PASSWORD="postgres"
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_NAME="postgres"
|
||||||
|
|
|
@ -64,11 +64,11 @@ WSGI_APPLICATION = "base.wsgi.application"
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||||
"NAME": "postgres",
|
"NAME": os.environ["DB_NAME"],
|
||||||
"USER": "postgres",
|
"USER": os.environ["DB_USER"],
|
||||||
"PASSWORD": "test",
|
"PASSWORD": os.environ["DB_PASSWORD"],
|
||||||
"HOST": "docker.host.internal",
|
"HOST": os.environ["DB_HOST"],
|
||||||
"PORT": "5432",
|
"PORT": os.environ["DB_PORT"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
backend/script/start.sh
Normal file
8
backend/script/start.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker run \
|
||||||
|
--detach \
|
||||||
|
--publish 8000:8000 \
|
||||||
|
--name $APP_CONTAINER_NAME \
|
||||||
|
--env-file ../backend.env \
|
||||||
|
rotini:dev
|
Reference in a new issue