feat: minimal func for start+stop+build

This commit is contained in:
Marc 2024-05-09 00:27:20 -04:00
parent 2618ec4243
commit 21b402d2bb
3 changed files with 47 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.env
.services

View file

@ -1,2 +1,7 @@
# scripts # scripts
_Quick and dirty utilities to build, start and stop services._
## Usage
Ensure that `go-task` is installed and `task -l`!

40
Taskfile.yml Normal file
View file

@ -0,0 +1,40 @@
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
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 }}"
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 }}"
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']