Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update operator-sdk and Go version #184

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
47 changes: 0 additions & 47 deletions CHANGELOG.md

This file was deleted.

95 changes: 23 additions & 72 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,78 +1,29 @@
#**********************************************************************
# Builder
# Create a go runtime suitable for building and testing kfctl
ARG GOLANG_VERSION=1.13.7
FROM golang:$GOLANG_VERSION as builder

ARG BRANCH=master
ARG REPO=https://github.com/kubeflow/kubeflow

RUN apt-get update
RUN apt-get install -y git unzip jq vim

# junit report is used to conver go test output to junit for reporting
RUN go get -u github.com/jstemmer/go-junit-report

# We need gcloud to get gke credentials.
RUN if [ "$(uname -m)" = "x86_64" ]; then \
cd /tmp && \
wget -nv https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash && \
chmod +x install_google_cloud_sdk.bash && \
./install_google_cloud_sdk.bash --disable-prompts --install-dir=/opt/; \
fi

ENV PATH /go/bin:/usr/local/go/bin:/opt/google-cloud-sdk/bin:${PATH}

# use go modules
ENV GO111MODULE=on
ENV GOPATH=/go
# Workaround for https://github.com/kubernetes/gengo/issues/146
ENV GOROOT=/usr/local/go

# Create kfctl folder
RUN mkdir -p ${GOPATH}/src/github.com/kubeflow/kfctl
WORKDIR ${GOPATH}/src/github.com/kubeflow
RUN mkdir kubeflow
RUN echo REPO=${REPO} branch=${BRANCH}
RUN git clone ${REPO} --depth=1 --branch ${BRANCH} --single-branch kubeflow
WORKDIR ${GOPATH}/src/github.com/kubeflow/kfctl

# Download dependencies first to optimize Docker caching.
COPY go.mod .
COPY go.sum .
# Build the manager binary
ARG GOLANG_VERSION=1.18.4
FROM registry.access.redhat.com/ubi8/go-toolset:$GOLANG_VERSION as builder

WORKDIR /workspace
LaVLaS marked this conversation as resolved.
Show resolved Hide resolved
USER root
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# 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 in the source
COPY . .

#**********************************************************************
#
# kfctl_base
#
FROM builder as kfctl_base

RUN make build-kfctl && \
if [ "$(uname -m)" = "aarch64" ]; then \
cp bin/arm64/kfctl bin/kfctl; \
fi

#**********************************************************************
#
# Final image base
#

FROM alpine:3.10.1 as barebones_base
RUN mkdir -p /opt/kubeflow
WORKDIR /opt/kubeflow
# Copy the go source
COPY main.go main.go
COPY apis/ apis/
COPY controllers/ controllers/
COPY pkg/ pkg/

#**********************************************************************
#
# kfctl
#
FROM barebones_base as kfctl
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
LaVLaS marked this conversation as resolved.
Show resolved Hide resolved

COPY --from=kfctl_base /go/src/github.com/kubeflow/kfctl/bin/kfctl /usr/local/bin
COPY --from=kfctl_base /go/src/github.com/kubeflow/kfctl/third_party /third_party
COPY --from=kfctl_base /go/pkg/mod /third_party/vendor

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

CMD ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait"]
ENTRYPOINT ["/manager"]
16 changes: 0 additions & 16 deletions Dockerfile.bundle

This file was deleted.

201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

Loading