There is this example how to use git with kaniko image build :
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
# automountServiceAccountToken: false
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args: [ "--dockerfile=kaniko/dockerfile/Dockerfile",
"--context=git://github.com/scriptcamp/kubernetes-kaniko",`enter code here`
I tried to use my git project with dockerfile NOT in root of git project and also with specifying git branch.
It would help if Kaniko-setups could be included in "real" projects. Not possible ??
EDIT :
Here : --dockerfile=kaniko/dockerfile/Dockerfile Kaniko docker build can find Dockerfile. But the build seems not to be able to find other files that are in the same directory (or below) , that Dockerfile build tries to copy to image being built.
This works if Dockerfile and other files that Dockerfile point to, all are at the root of gitbub repository.
EDIT 2 :
OK. If [kube/restapi/docker/] Dockerfile that docker-compose uses looks like this :
FROM openjdk:11
ARG JAR_FILE=./app.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
Then if I would like to build this Dockerfile with Kaniko on Kubernetes, I have to add path from root of my project (and github repo), like this :
FROM openjdk:11
COPY kube/restapi/docker/app.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
-- I was very excited of the possibility to be able to use same Dockerfile both with docker-compose setup and with Kaniko on Kubernetes.
Hope that someone finds a way to "fix" this.
https://github.com/GoogleContainerTools/kaniko/issues/1064
spec.containers.args: