Switch to multi-stage dockerfile for building kaniko
This commit is contained in:
parent
ea9258b569
commit
3705de2298
|
|
@ -14,8 +14,14 @@
|
|||
|
||||
# Builds the static Go image to execute in a Kubernetes job
|
||||
|
||||
FROM golang
|
||||
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko
|
||||
RUN apt-get update && apt-get install -y make
|
||||
COPY . .
|
||||
RUN make -B
|
||||
|
||||
FROM scratch
|
||||
COPY out/executor /kaniko/executor
|
||||
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kaniko/executor
|
||||
COPY files/ca-certificates.crt /kaniko/ssl/certs/
|
||||
COPY files/docker-credential-gcr /usr/local/bin/
|
||||
COPY files/config.json /root/.docker/
|
||||
|
|
|
|||
|
|
@ -1,31 +1,6 @@
|
|||
steps:
|
||||
# First, install make
|
||||
- name: "gcr.io/google-appengine/debian9"
|
||||
args: ["sh", "-c", "apt-get update && apt-get install -y make"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
- name: "gcr.io/google-appengine/debian9"
|
||||
args: ["sh", "-c", "cp -r . /kaniko/ && mkdir -p /workspace/go/src/github.com/GoogleContainerTools/ && cp -r /kaniko/ /workspace/go/src/github.com/GoogleContainerTools/"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
# Then, build the binary
|
||||
- name: "gcr.io/google-appengine/golang"
|
||||
args: ["sh", "-c", "make"]
|
||||
volumes:
|
||||
- name: "make"
|
||||
path: "/usr/bin"
|
||||
dir: go/src/github.com/GoogleContainerTools/kaniko
|
||||
env: ["GOPATH=/workspace/go/"]
|
||||
# First, build kaniko
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["build", "-f", "deploy/Dockerfile",
|
||||
"-t", "gcr.io/kaniko-project/executor:${COMMIT_SHA}", "."]
|
||||
dir: go/src/github.com/GoogleContainerTools/kaniko
|
||||
# Then, build kaniko:debug
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args: ["build", "-f", "deploy/Dockerfile_debug",
|
||||
"-t", "gcr.io/kaniko-project/executor:debug-${COMMIT_SHA}", "."]
|
||||
dir: go/src/github.com/GoogleContainerTools/kaniko
|
||||
images: ["gcr.io/kaniko-project/executor:${COMMIT_SHA}", "gcr.io/kaniko-project/executor:debug-${COMMIT_SHA}"]
|
||||
images: ["gcr.io/kaniko-project/executor:${COMMIT_SHA}"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue