Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 committed Dec 22, 2020
1 parent 86e361c commit b5a096b
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 492 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/release.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions BUILD

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ integration-test-misc:

.PHONY: images
images:
docker build ${BUILD_ARG} --build-arg=GOARCH=$(GOARCH) -t $(REGISTRY)/executor:latest -f deploy/Dockerfile .
docker build ${BUILD_ARG} --build-arg=GOARCH=$(GOARCH) -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug .
docker build ${BUILD_ARG} --build-arg=GOARCH=$(GOARCH) -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer .
docker build ${BUILD_ARG} --build-arg=TARGETARCH=$(GOARCH) --build-arg=BUILDPLATFORM=linux/$(GOARCH) -t $(REGISTRY)/executor:latest -f deploy/Dockerfile .
docker build ${BUILD_ARG} --build-arg=TARGETARCH=$(GOARCH) --build-arg=BUILDPLATFORM=linux/$(GOARCH) -t $(REGISTRY)/executor:debug -f deploy/Dockerfile_debug .
docker build ${BUILD_ARG} --build-arg=TARGETARCH=$(GOARCH) --build-arg=BUILDPLATFORM=linux/$(GOARCH) -t $(REGISTRY)/warmer:latest -f deploy/Dockerfile_warmer .

.PHONY: push
push:
Expand Down
53 changes: 0 additions & 53 deletions WORKSPACE

This file was deleted.

61 changes: 0 additions & 61 deletions cmd/executor/BUILD

This file was deleted.

24 changes: 9 additions & 15 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@

# Builds the static Go image to execute in a Kubernetes job

FROM golang:1.14
ARG GOARCH=amd64
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

RUN echo $GOARCH > /goarch
ARG BUILDPLATFORM
FROM --platform=${BUILDPLATFORM} golang:1.14
ARG TARGETARCH

#This arg is passed by docker buildx & contains the platform info in the form linux/amd64, linux/ppc64le etc.
ARG TARGETPLATFORM

#Capture ARCH has write to /goarch
RUN [ ! "x" = "x$TARGETPLATFORM" ] && `echo $TARGETPLATFORM | awk '{split($0,a,"/"); print a[2]}' > /goarch` || echo "$GOARCH"
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

# Get GCR credential helper
RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \
RUN GOARCH=${TARGETARCH} && CGO_ENABLED=0 && \
(mkdir -p /go/src/github.com/GoogleCloudPlatform || true) && \
cd /go/src/github.com/GoogleCloudPlatform && \
git clone https://github.com/GoogleCloudPlatform/docker-credential-gcr.git && \
Expand All @@ -36,12 +30,12 @@ RUN GOARCH=$(cat /goarch) && CGO_ENABLED=0 && \
go build -ldflags "-linkmode external -extldflags -static" -i -o /usr/local/bin/docker-credential-gcr main.go

# Get Amazon ECR credential helper
RUN GOARCH=$(cat /goarch) && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \
RUN GOARCH=${TARGETARCH} && go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login && \
make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper

# ACR docker credential helper
COPY ./acr.patch /
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/Azure || true) && \
RUN GOARCH=${TARGETARCH} && (mkdir -p /go/src/github.com/Azure || true) && \
cd /go/src/github.com/Azure && \
git clone https://github.com/Azure/acr-docker-credential-helper && \
cd /go/src/github.com/Azure/acr-docker-credential-helper && \
Expand All @@ -50,7 +44,7 @@ RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/Azure || true) && \
make && cp -f bin/linux/${GOARCH}/docker-credential-acr-linux /usr/local/bin/docker-credential-acr-linux

#ACR docker env credential helper
RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true) && \
RUN GOARCH=${TARGETARCH} && (mkdir -p /go/src/github.com/chrismellard || true) && \
cd /go/src/github.com/chrismellard && \
git clone https://github.com/chrismellard/docker-credential-acr-env && \
cd docker-credential-acr-env && \
Expand All @@ -60,7 +54,7 @@ RUN GOARCH=$(cat /goarch) && (mkdir -p /go/src/github.com/chrismellard || true)
RUN mkdir -p /kaniko/.docker

COPY . .
RUN make GOARCH=$(cat /goarch.txt)
RUN make GOARCH=${TARGETARCH}

FROM scratch
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/executor /kaniko/executor
Expand Down
10 changes: 7 additions & 3 deletions deploy/Dockerfile_debug
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
# Builds the static Go image to execute in a Kubernetes job

# Stage 0: Build the executor binary and get credential helpers
FROM golang:1.14
ARG GOARCH=amd64
ARG BUILDPLATFORM
FROM --platform=${BUILDPLATFORM} golang:1.14
ARG TARGETARCH

WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

# Get GCR credential helper
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.2/docker-credential-gcr_linux_amd64-2.0.2.tar.gz /usr/local/bin/
RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-2.0.2.tar.gz

# Get Amazon ECR credential helper
RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64
Expand All @@ -35,7 +39,7 @@ RUN tar --no-same-owner -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credentia
RUN mkdir -p /kaniko/.docker

COPY . .
RUN make GOARCH=${GOARCH} && make out/warmer
RUN make GOARCH=${TARGETARCH} && make out/warmer

FROM scratch
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/* /kaniko/
Expand Down
34 changes: 34 additions & 0 deletions deploy/Dockerfile_slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2020 Google, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Builds the static Go image to execute in a Kubernetes job

ARG BUILDPLATFORM
FROM --platform=${BUILDPLATFORM} golang:1.14
ARG TARGETARCH

WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

COPY . .
RUN make GOARCH=${TARGETARCH}

FROM scratch
COPY files/nsswitch.conf /etc/nsswitch.conf
ENV HOME /root
ENV USER root
ENV PATH /usr/local/bin:/kaniko
ENV SSL_CERT_DIR=/kaniko/ssl/certs

ENTRYPOINT ["/kaniko/executor"]

9 changes: 6 additions & 3 deletions deploy/Dockerfile_warmer
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
# limitations under the License.

# Builds the static Go image to execute in a Kubernetes job
ARG BUILDPLATFORM
FROM --platform=${BUILDPLATFORM} golang:1.14
ARG TARGETARCH

FROM golang:1.14
ARG GOARCH=amd64
WORKDIR /go/src/github.com/GoogleContainerTools/kaniko

# Get GCR credential helper
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.0.1/docker-credential-gcr_linux_amd64-2.0.1.tar.gz /usr/local/bin/
RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-gcr_linux_amd64-2.0.1.tar.gz

# Get Amazon ECR credential helper
RUN go get -u github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
RUN make -C /go/src/github.com/awslabs/amazon-ecr-credential-helper linux-amd64
Expand All @@ -30,7 +33,7 @@ RUN tar -C /usr/local/bin/ -xvzf /usr/local/bin/docker-credential-acr-linux-amd6
RUN mkdir -p /kaniko/.docker

COPY . .
RUN make GOARCH=${GOARCH} out/warmer
RUN make GOARCH=${TARGETARCH} out/warmer

FROM scratch
COPY --from=0 /go/src/github.com/GoogleContainerTools/kaniko/out/warmer /kaniko/warmer
Expand Down
Loading

0 comments on commit b5a096b

Please sign in to comment.