Skip to content

Instantly share code, notes, and snippets.

@ImJasonH ImJasonH/Dockerfile
Last active Nov 19, 2019

Embed
What would you like to do?
demo
FROM ubuntu
ADD doll.sh /
ENTRYPOINT ["/doll.sh"]
#!/bin/bash
out=/workspace/doll
touch ${out}
rand=$(( ( RANDOM % 5 ) + 1 ))
for (( c=1; c<=$rand; c++ )); do
echo -n .
sleep 1
done
echo
arg=$1
case "$arg" in
outer-top)
cat >> $out << EOF
A____A
/ @ @ \\
/________\\
EOF
;;
middle-top)
cat >> $out << EOF
A__A
/ OO \\
/______\\
EOF
;;
inner-top)
cat >> $out << EOF
A__A
/_oo_\\
EOF
;;
kitty)
cat >> $out << EOF
A__A - meow!
\\oo/
EOF
;;
inner-bottom)
cat >> $out << EOF
|----|
\____/
EOF
;;
middle-bottom)
cat >> $out << EOF
|------|
\______/
EOF
;;
outer-bottom)
cat >> $out << EOF
|--------|
\________/
EOF
;;
esac
# Run the pod
kubectl delete pod pod && \
kubectl create -f pod.yaml && \
sleep 5 && \
kubectl logs pod -f -c print
# Run the TaskRun
kubectl delete taskrun taskrun && \
kubectl create -f taskrun.yaml && \
sleep 5 && \
kubectl logs $(kubectl get taskrun taskrun -ojsonpath={.status.podName}) -c step-print -f
apiVersion: v1
kind: Pod
metadata:
name: pod
spec:
containers:
- name: outer-top
image: imjasonh/doll
args: ['outer-top']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: middle-top
image: imjasonh/doll
args: ['middle-top']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: inner-top
image: imjasonh/doll
args: ['inner-top']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: kitty
image: imjasonh/doll
args: ['kitty']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: inner-bottom
image: imjasonh/doll
args: ['inner-bottom']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: middle-bottom
image: imjasonh/doll
args: ['middle-bottom']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: outer-bottom
image: imjasonh/doll
args: ['outer-bottom']
volumeMounts:
- name: workspace
mountPath: /workspace
- name: print
image: ubuntu
command: ['sh', '-c']
args:
- |
sleep 10
cat /workspace/doll
volumeMounts:
- name: workspace
mountPath: /workspace
volumes:
- name: workspace
emptyDir: {}
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: taskrun
spec:
taskSpec:
steps:
- name: outer-top
image: imjasonh/doll
args: ['outer-top']
- name: middle-top
image: imjasonh/doll
args: ['middle-top']
- name: inner-top
image: imjasonh/doll
args: ['inner-top']
- name: kitty
image: imjasonh/doll
args: ['kitty']
- name: inner-bottom
image: imjasonh/doll
args: ['inner-bottom']
- name: middle-bottom
image: imjasonh/doll
args: ['middle-bottom']
- name: outer-bottom
image: imjasonh/doll
args: ['outer-bottom']
- name: print
image: ubuntu
command: ['cat', '/workspace/doll']
#!/usr/bin/env bash
docker build -t imjasonh/doll .
docker push imjasonh/doll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.