/build-push-image-tekton

My demo teaching how to create, build and push a docker image to DockerHub

build-push-image-tekton

My demo showing how to create, build and push a docker image to DockerHub

Install Tekton Pipelines

kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml

Install Tekton Dashboard

kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml

To view, the dashboard

kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097
Screenshot 2023-10-12 at 13 24 15

Install Tekton's CLI (MacOS)

brew install tektoncd-cli

Authenticating to DockerHub

  • Log into Docker via CLI
docker login
  • Create an encoded string of your docker-hub-user-name-:docker-hub-password
$ echo -n '<docker-hub-username>:<docker-hub-password>' | base64
ENCODED-STRING
  • Edit ~/.docker/config.json
$ sudo nano ~/.docker/config.json
{ "auths": { "https://index.docker.io/v1/": { "auth": "ENCODED-STRING" } } }
  • Encode ~/.docker/config.json
$ cat ~/.docker/config.json | base64
ENCODED-JSON-FILE

Create Deployment

  • Create a DockerHub repository to store your image in.
tkn hub install task git-clone
tkn hub install task kaniko
kubectl apply -f docker-secret.yaml
kubectl apply -f pipeline.yaml
kubectl create -f pipeline-run.yaml
image

Task

image

Pipeline

Screenshot 2023-10-12 at 14 57 28

PipelineRun

Screenshot 2023-10-12 at 15 46 47

Article