---
# Kaniko builds images without docker
#
# Use 'kubectl create -f kaniko.yaml' to execute
# 
# NOTES:
# If this is your first kaniko, you need to add a token:
# In gogs: User->Settings->Applications
# kubectl create secret generic git-token --from-literal='GIT_TOKEN=<your-token>'
# 
# You need to add credentials to the docker registry:
# kubectl create secret docker-registry  docker-regcred \
#  --docker-server=https://index.docker.io/v1/ \
#  --docker-username=<your-username> \
#  --docker-password=<your-password>
apiVersion: v1
kind: Pod
metadata:
  generateName: kaniko-discord-downloader-go-
spec:
  containers:
  - name: kaniko-discord-downloader-go
    image: gcr.io/kaniko-project/executor:v1.9.1 
    args:
    - "--dockerfile=./Dockerfile"
    - "--context=git://git.monkeybox.org/Containers/discord-downloader-go#refs/heads/master"
    - "--destination=fdamstra/discord-downloader-go:latest"
    env:
      - name: GIT_TOKEN
        valueFrom:
          secretKeyRef:
            name: git-token
            key: GIT_TOKEN
    volumeMounts:
    - name: docker-config
      mountPath: /kaniko/.docker/
  dnsPolicy: "None"
  dnsConfig:
    nameservers:
      - 10.42.42.239
      - 10.42.42.1
    searches:
      - default.svc.cluster.local
      - svc.cluster.local
      - cluster.local
    options:
      - name: ndots
        value: "2"
      - name: edns0
      - name: trust-ad
  restartPolicy: Never
  volumes:
  - name: docker-config
    secret:
      secretName: docker-regcred
      items:
          - key: .dockerconfigjson
            path: config.json
