-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildah.yaml
55 lines (55 loc) · 1.64 KB
/
buildah.yaml
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
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: buildah
spec:
params:
- name: IMAGE
description: Reference of the image buildah will produce.
- name: STORAGE_DRIVER
description: Set buildah storage driver
default: overlay
- name: DOCKERFILE
description: Path to the Dockerfile to build.
default: ./Dockerfile
- name: IMAGE_PUSH_SECRET_NAME
description: Kubernetes secrets contain image push username and password
workspaces:
- name: source
steps:
- name: build
image: quay.io/buildah/stable:v1.17.0
workingDir: $(workspaces.source.path)
script: |
buildah --storage-driver=$(params.STORAGE_DRIVER) bud \
--no-cache -f $(params.DOCKERFILE) -t $(params.IMAGE) .
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
- name: push
image: quay.io/buildah/stable:v1.17.0
workingDir: $(workspaces.source.path)
script: |
buildah --storage-driver=$(params.STORAGE_DRIVER) push \
--creds ${USERNAME}:${PASSWORD} $(params.IMAGE)
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
env:
- name: USERNAME
valueFrom:
secretKeyRef:
name: $(params.IMAGE_PUSH_SECRET_NAME)
key: username
- name: PASSWORD
valueFrom:
secretKeyRef:
name: $(params.IMAGE_PUSH_SECRET_NAME)
key: password
volumes:
- name: varlibcontainers
emptyDir: {}