scripts/Taskfile.yml

47 lines
1.5 KiB
YAML

version: '3'
output: prefixed
vars:
SERVICES_ROOT: "{{ .ROOT_DIR }}/.services"
CONFIG_ROOT: "/etc/opt/spadinastan"
tasks:
build:
desc: Builds a service by name.
prefix: "build image: {{ .CLI_ARGS }}"
interactive: true
preconditions:
- test -f {{.CONFIG_ROOT}}/common.env
cmds:
- rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}}
- git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}"
- cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./build.sh
env:
IMAGE_VERSION: "{{.IMAGE_VERSION}}"
start:
desc: Starts a service by name.
prefix: "start: {{ .CLI_ARGS }}"
preconditions:
- test -f {{.CONFIG_ROOT}}/common.env
- test -f {{.CONFIG_ROOT}}/{{.CLI_ARGS}}.env
cmds:
- rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}}
- git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}"
- cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./start.sh
dotenv: ['common.env']
env:
IMAGE_VERSION: "{{.IMAGE_VERSION}}"
ENV_FILE_DIR: "{{.CONFIG_ROOT}}"
stop:
desc: Stops a service by name.
prefix: "stop: {{ .CLI_ARGS }}"
preconditions:
- test -f {{.CONFIG_ROOT}}/common.env
cmds:
- rm -rf {{.SERVICES_ROOT}}/{{.CLI_ARGS}}
- git clone "git@forge-ssh.karnov.club:spadinastan/{{.CLI_ARGS}}.git" "{{.SERVICES_ROOT}}/{{.CLI_ARGS}}"
- cd {{ .SERVICES_ROOT }}/{{ .CLI_ARGS }} && . ./stop.sh
dotenv: ['common.env']