File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+
3
+ vars :
4
+ IMAGE_NAME : ghcr.io/kotaicode/ubuntu-devops
5
+ LATEST_TAG : latest
6
+ VERSION : ' {{.CLI_VERSION | default "dev"}}'
7
+
8
+ tasks :
9
+ default :
10
+ cmds :
11
+ - task --list
12
+ silent : true
13
+
14
+ build :
15
+ desc : Build the Docker image locally
16
+ cmds :
17
+ - docker build -t {{.IMAGE_NAME}}:{{.LATEST_TAG}} .
18
+ - docker tag {{.IMAGE_NAME}}:{{.LATEST_TAG}} {{.IMAGE_NAME}}:{{.VERSION}}
19
+
20
+ run :
21
+ desc : Run the container locally
22
+ cmds :
23
+ - docker run --rm -it {{.IMAGE_NAME}}:{{.LATEST_TAG}} bash
24
+
25
+ k8s-shell :
26
+ desc : Run an interactive shell in a Kubernetes cluster
27
+ cmds :
28
+ - kubectl run ubuntu-devops-shell --rm -i --tty --image {{.IMAGE_NAME}}:{{.LATEST_TAG}} -- bash
29
+
30
+ release :
31
+ desc : Create a new release by building and pushing the image
32
+ cmds :
33
+ - |
34
+ if [ -z "{{.VERSION}}" ] || [ "{{.VERSION}}" = "dev" ]; then
35
+ echo "Error: VERSION is required for release"
36
+ exit 1
37
+ fi
38
+ - task : build
39
+ - docker push {{.IMAGE_NAME}}:{{.LATEST_TAG}}
40
+ - docker push {{.IMAGE_NAME}}:{{.VERSION}}
41
+ - git tag v{{.VERSION}}
42
+ - git push origin v{{.VERSION}}
43
+
44
+ clean :
45
+ desc : Remove local Docker images
46
+ cmds :
47
+ - docker rmi {{.IMAGE_NAME}}:{{.LATEST_TAG}} || true
48
+ - docker rmi {{.IMAGE_NAME}}:{{.VERSION}} || true
You can’t perform that action at this time.
0 commit comments