From 8751a93691bb1ea0eee65777067100c515ae4be6 Mon Sep 17 00:00:00 2001 From: Muvaffak Onus Date: Fri, 10 Jan 2020 20:29:18 +0300 Subject: [PATCH 1/2] init: Dockerfile updated for go 1.13 and COPY method includes all folders to cover cases where user adds another go package Signed-off-by: Muvaffak Onus --- bin/kubectl-crossplane-stack-init | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/bin/kubectl-crossplane-stack-init b/bin/kubectl-crossplane-stack-init index c278639..b4a642b 100755 --- a/bin/kubectl-crossplane-stack-init +++ b/bin/kubectl-crossplane-stack-init @@ -170,27 +170,18 @@ function check_for_existing_stack { function create_build { cat > stack.Dockerfile <<'EOF' # Build the manager binary -FROM golang:1.12.5 as builder - +FROM golang:1.13.6 as builder WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum +COPY . . # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer RUN go mod download - -# Copy the go source -COPY main.go main.go -COPY api/ api/ -COPY controllers/ controllers/ - # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go # Use alpine as a minimal base image to package the manager binary # Alpine is used instead of distroless because the stack manager expects things like `cp` to exist -FROM alpine:3.7 +FROM alpine:3.11 WORKDIR / COPY stack-package / COPY --from=builder /workspace/manager . From cb9d9946745ec0ec4756f20a4f064596f3e6a4d5 Mon Sep 17 00:00:00 2001 From: Muvaffak Onus Date: Thu, 20 Feb 2020 16:09:12 +0300 Subject: [PATCH 2/2] Make sure .dockerignore and .gitignore files are in place and correct additions are made Signed-off-by: Muvaffak Onus --- bin/kubectl-crossplane-stack-init | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/kubectl-crossplane-stack-init b/bin/kubectl-crossplane-stack-init index b4a642b..f07c4a7 100755 --- a/bin/kubectl-crossplane-stack-init +++ b/bin/kubectl-crossplane-stack-init @@ -332,17 +332,21 @@ EOF echo 'Created stack.Makefile' >&2 - if [ -f .gitignore ] ; then - grep -q 'stack-package/' .gitignore || cat >>.gitignore < /dev/null 2>&1 || cat >>.gitignore <&2 - else - echo 'No .gitignore found; not adding stack-package/ to .gitignore' >&2 - fi + echo 'Made sure stack-package/ is in .gitignore' >&2 + + grep -q '.git/' .dockerignore > /dev/null 2>&1 || cat >>.dockerignore <&2 } cd -- "${INIT_DIR}"