-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.docker.yml
More file actions
32 lines (28 loc) · 926 Bytes
/
Copy pathTaskfile.docker.yml
File metadata and controls
32 lines (28 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
GIT_REV:
sh: git describe --tags --always --dirty=-$(git diff | git hash-object --stdin | cut -c1-8)
REGISTRY_HOST: '{{.REGISTRY_HOST | default "localhost"}}'
REGISTRY_PORT: '{{.REGISTRY_PORT | default "5001"}}'
REGISTRY: "{{.REGISTRY_HOST}}:{{.REGISTRY_PORT}}"
IMAGE_TAG: "{{ .IMAGE_TAG | default .GIT_REV }}"
tasks:
build:
desc: "Build an image. Usage: task build APP=backend DIR=./backend"
dir: '{{.DIR | default "."}}'
requires:
vars: [APP]
vars:
FULL_IMAGE: "{{.REGISTRY}}/{{.APP}}:{{.IMAGE_TAG}}"
cmds:
- echo {{.FULL_IMAGE}}
- docker build -t {{.FULL_IMAGE}} .
push:
desc: "Push an image. Usage: task push APP=backend"
requires:
vars: [APP]
vars:
FULL_IMAGE: "{{.REGISTRY}}/{{.APP}}:{{.IMAGE_TAG}}"
cmds:
- docker push {{.FULL_IMAGE}}