Skip to content

Instantly share code, notes, and snippets.

@MansM
Created February 21, 2019 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MansM/d72295cc7214fc11f258ba7a22605d2e to your computer and use it in GitHub Desktop.
Save MansM/d72295cc7214fc11f258ba7a22605d2e to your computer and use it in GitHub Desktop.
# original borrowed from https://www.trion.de/news/2019/02/01/kaniko-arm-image.html and adapted to normal arm instead of arm64
# keep in mind you need to put the arch in every FROM..... or it wont work
---
apiVersion: batch/v1
kind: Job
metadata:
name: kaniko-build
labels:
run: dind
name: dind
spec:
ttlSecondsAfterFinished: 10
template:
spec:
initContainers:
- name: git-clone
image: alpine
args:
- /bin/sh
- '-c'
- 'apk add -U --no-cache git; git clone --depth=1 --single-branch https://github.com/GoogleContainerTools/kaniko.git /repo; echo "done"'
volumeMounts:
- name: git-repo
mountPath: /repo
containers:
- image: 'docker:dind'
name: dind
# args:
# - '--insecure-registry=registry.docker-registry:5000'
workingDir: /repo
securityContext:
privileged: true
volumeMounts:
- name: cache-volume
mountPath: /tmp
- name: container-volume
mountPath: /var/lib/docker
- name: git-repo
mountPath: /repo
- image: 'docker:dind'
name: docker
args:
- /bin/sh
- '-c'
- 'cat -n deploy/Dockerfile; sed -i "19,25d;32d;33d;35d;43d" deploy/Dockerfile; sed -i "s/FROM scratch/FROM busybox/g" deploy/Dockerfile; echo "ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/kaniko" >> deploy/Dockerfile; cat -n deploy/Dockerfile; sed -i s@amd64@arm@g Makefile; docker build -f deploy/Dockerfile -t mansm/kaniko-executor:debug .; docker images; docker push mansm/kaniko-executor:debug; echo "completed"'
workingDir: /repo
env:
# - name: DOCKER_HOST
# value: 'tcp://localhost:2375'
volumeMounts:
- name: cache-volume
mountPath: /tmp
- name: git-repo
mountPath: /repo
- mountPath: /var/run/docker.sock
name: dockersock
volumes:
- name: container-volume
emptyDir: {}
- name: cache-volume
emptyDir: {}
- name: git-repo
emptyDir: {}
- name: dockersock
hostPath:
path: /var/run/docker.sock
restartPolicy: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment