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

make Dockerfile & Makefile cross platform #670

Merged
merged 2 commits into from
Apr 18, 2018
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion bootstrap/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# TODO(jlewi): How can we make it work with golang:1.8.2-alpine
FROM golang:1.8.2 as builder

RUN mkdir -p /opt/kubeflow

ENV PATH /go/bin:/usr/local/go/bin:$PATH

RUN mkdir -p $GOPATH/src/github.com/kubeflow/kubeflow/bootstrap
COPY ./ $GOPATH/src/github.com/kubeflow/kubeflow/bootstrap/

RUN go build -i -o /opt/kubeflow/bootstraper ${GOPATH}/src/github.com/kubeflow/kubeflow/bootstrap/cmd/bootstrap/main.go

FROM golang:1.8.2

# We need gcloud to get gke credentials.
Expand Down Expand Up @@ -37,7 +48,7 @@ RUN cd /opt/ksonnet && \

RUN mkdir -p /opt/kubeflow

COPY bootstraper /opt/kubeflow/
COPY --from=builder /opt/kubeflow/bootstraper /opt/kubeflow/
COPY start.sh /opt/kubeflow/

RUN chmod a+rx /opt/kubeflow/*
Expand Down
9 changes: 2 additions & 7 deletions bootstrap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@
IMG = gcr.io/kubeflow-images-staging/bootstraper

TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)-$(shell git diff | shasum -a256 | cut -c -6)
DIR := ${CURDIR}
BUILDDIR := $(shell mktemp --tmpdir -d)

all: build

# To build without the cache set the environment variable
# export DOCKER_BUILD_OPTS=--no-cache
build:
go build -i -o $(BUILDDIR)/bootstraper ${GOPATH}/src/github.com/kubeflow/kubeflow/bootstrap/cmd/bootstrap/main.go
cp -f ./Dockerfile $(BUILDDIR)/
cp -f ./start.sh $(BUILDDIR)/
docker build ${DOCKER_BUILD_OPTS} -t $(IMG):$(TAG) $(BUILDDIR)
build:
docker build ${DOCKER_BUILD_OPTS} -t $(IMG):$(TAG) .
docker tag $(IMG):$(TAG) $(IMG):latest
@echo Built $(IMG):latest
@echo Built $(IMG):$(TAG)
Expand Down