-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
79 lines (76 loc) · 2.57 KB
/
Taskfile.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# https://taskfile.dev
version: '3'
dotenv: [secrets/aws-ecr.env]
vars:
LORIS_SOURCE: release
LORIS_VERSION: "26.0.0"
PLATFORM: linux/amd64
LORIS_MRI_VERSION: "26.0.0"
NO_CACHE: false
GIT_COMMIT:
sh: git rev-parse --short HEAD
TIMESTAMP:
sh: date +%Y%m%d%H%M%S
AWS_ECR_REPO: "{{.AWS_ACCOUNT_ID}}.dkr.ecr.{{.AWS_ECR_REGION}}.amazonaws.com/{{.AWS_ECR_REPO_NAME}}"
AWS_ECR_REPO_TAG: "{{.AWS_ACCOUNT_ID}}.dkr.ecr.{{.AWS_ECR_REGION}}.amazonaws.com/{{.AWS_ECR_REPO_NAME}}:{{.AWS_ECR_IMAGE_TAG}}"
tasks:
loris:
cmds:
- task: build-docker
vars:
IMAGE: loris
IMAGE_NAME: loris
BUILD_ARGS: ["LORIS_SOURCE={{.LORIS_SOURCE}}", "LORIS_BASE=loris-base", "BASE_TAG=latest"]
TAGS: ["{{.GIT_COMMIT}}", "{{.TIMESTAMP}}", "latest"]
deps: [loris-base]
loris-mri:
deps: [loris-mri-deps]
cmds:
- task: build-docker
vars:
IMAGE: loris-mri
IMAGE_NAME: loris-mri
BUILD_ARGS: ["LORIS_SOURCE={{.LORIS_SOURCE}}", "LORIS_MRI_VERSION={{.LORIS_MRI_VERSION}}", "BASE_TAG=latest"]
TAGS: ["{{.GIT_COMMIT}}", "{{.TIMESTAMP}}", "latest", "{{.AWS_ECR_REPO_TAG}}"]
loris-mri-deps:
deps: [loris-mri-base]
cmds:
- task: build-docker
vars:
IMAGE: loris
IMAGE_NAME: loris-mri-deps
BUILD_ARGS: ["LORIS_SOURCE={{.LORIS_SOURCE}}", "LORIS_BASE=loris-mri-base", "BASE_TAG=latest"]
TAGS: ["{{.GIT_COMMIT}}", "{{.TIMESTAMP}}", "latest"]
loris-mri-base:
deps: [loris-base]
cmds:
- task: build-docker
vars:
IMAGE: loris-mri-base
IMAGE_NAME: loris-mri-base
TAGS: ["{{.GIT_COMMIT}}", "{{.TIMESTAMP}}", "latest"]
loris-base:
cmds:
- task: build-docker
vars:
IMAGE: loris-base
IMAGE_NAME: loris-base
TAGS: ["{{.GIT_COMMIT}}", "{{.TIMESTAMP}}", "latest"]
push-ecr:
cmds:
- >-
aws ecr get-login-password --region {{.AWS_REGION}} | docker login --username AWS --password-stdin "{{.AWS_ACCOUNT_ID}}.dkr.ecr.{{.AWS_ECR_REGION}}.amazonaws.com/{{.AWS_ECR_REPO_NAME}}"
- >-
docker push {{.AWS_ECR_REPO_TAG}}
build-docker:
internal: true
cmds:
- >-
docker buildx build
{{if .NO_CACHE}}--no-cache{{end}}
{{if .PLATFORM}}{{printf "--platform %s" .PLATFORM}}{{end}}
{{range .BUILD_ARGS}}{{cat "--build-arg " . ""}}{{end}}
{{range .TAGS }}{{printf "-t %s:%s " $.IMAGE_NAME . }}{{end}}
-f {{.IMAGE}}/{{.IMAGE}}.Dockerfile {{.IMAGE}}
requires:
vars: [IMAGE, IMAGE_NAME]