Skip to content

Commit 67d3e50

Browse files
committed
modify script to build container image
1 parent 2392b88 commit 67d3e50

File tree

28 files changed

+466
-86
lines changed

28 files changed

+466
-86
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
HAS_LINT := $(shell command -v golangci-lint;)
22
COMMIT := v1beta1-$(shell git rev-parse --short=7 HEAD)
33
KATIB_REGISTRY := docker.io/kubeflowkatib
4+
CPU_ARCH ?= amd64
45

56
# Run tests
67
.PHONY: test
@@ -49,10 +50,10 @@ endif
4950

5051
# Build images for the Katib v1beta1 components.
5152
build: generate
52-
ifeq ($(and $(REGISTRY),$(TAG)),)
53-
$(error REGISTRY and TAG must be set. Usage: make build REGISTRY=<registry> TAG=<tag>)
53+
ifeq ($(and $(REGISTRY),$(TAG),$(CPU_ARCH)),)
54+
$(error REGISTRY and TAG must be set. Usage: make build REGISTRY=<registry> TAG=<tag> CPU_ARCH=<cpu-architecture>)
5455
endif
55-
bash scripts/v1beta1/build.sh $(REGISTRY) $(TAG)
56+
bash scripts/v1beta1/build.sh $(REGISTRY) $(TAG) $(CPU_ARCH)
5657

5758
# Build and push Katib images from the latest master commit.
5859
push-latest: generate

cmd/earlystopping/medianstop/v1beta1/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ ENV TARGET_DIR /opt/katib
44
ENV EARLY_STOPPING_DIR cmd/earlystopping/medianstop/v1beta1
55

66
RUN if [ "$(uname -m)" = "ppc64le" ] || [ "$(uname -m)" = "aarch64" ]; then \
7-
apt-get -y update && \
8-
apt-get -y install gfortran libopenblas-dev liblapack-dev && \
9-
pip install cython; \
7+
apt-get -y update && \
8+
apt-get -y install gfortran libopenblas-dev liblapack-dev && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/*; \
1011
fi
1112

1213
ADD ./pkg/ ${TARGET_DIR}/pkg/

cmd/earlystopping/medianstop/v1beta1/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ grpcio==1.41.1
22
protobuf==3.19.1
33
googleapis-common-protos==1.6.0
44
kubernetes==11.0.0
5+
cython>=0.29.24
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
psutil==5.6.6
2-
rfc3339
3-
grpcio
4-
googleapis-common-protos
2+
rfc3339>=6.2
3+
grpcio==1.41.1
4+
googleapis-common-protos==1.6.0

cmd/new-ui/v1beta1/Dockerfile.ppc64le

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# --- Clone the kubeflow/kubeflow code ---
2+
FROM ubuntu AS fetch-kubeflow-kubeflow
3+
4+
RUN apt-get update && apt-get install git -y
5+
6+
WORKDIR /kf
7+
RUN git clone https://github.com/kubeflow/kubeflow.git && \
8+
cd kubeflow && \
9+
git checkout 24bcb8e
10+
11+
# --- Build the frontend kubeflow library ---
12+
FROM ppc64le/node:12 AS frontend-kubeflow-lib
13+
14+
WORKDIR /src
15+
16+
ARG LIB=/kf/kubeflow/components/crud-web-apps/common/frontend/kubeflow-common-lib
17+
COPY --from=fetch-kubeflow-kubeflow $LIB/package*.json ./
18+
RUN npm ci
19+
20+
COPY --from=fetch-kubeflow-kubeflow $LIB/ ./
21+
RUN npm run build
22+
23+
# --- Build the frontend ---
24+
FROM ppc64le/node:12 AS frontend
25+
26+
WORKDIR /src
27+
COPY ./pkg/new-ui/v1beta1/frontend/package*.json ./
28+
RUN npm ci
29+
30+
COPY ./pkg/new-ui/v1beta1/frontend/ .
31+
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
32+
33+
RUN npm run build:prod
34+
35+
# --- Build the backend ---
36+
FROM golang:alpine AS go-build
37+
38+
WORKDIR /go/src/github.com/kubeflow/katib
39+
40+
# Download packages.
41+
COPY go.mod .
42+
COPY go.sum .
43+
RUN go mod download -x
44+
45+
# Copy sources.
46+
COPY cmd/ cmd/
47+
COPY pkg/ pkg/
48+
49+
# Build the binary.
50+
RUN if [ "$(uname -m)" = "ppc64le" ]; then \
51+
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -a -o katib-ui ./cmd/new-ui/v1beta1; \
52+
elif [ "$(uname -m)" = "aarch64" ]; then \
53+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o katib-ui ./cmd/new-ui/v1beta1; \
54+
else \
55+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o katib-ui ./cmd/new-ui/v1beta1; \
56+
fi
57+
58+
# --- Compose the web app ---
59+
FROM alpine:3.7
60+
WORKDIR /app
61+
COPY --from=go-build /go/src/github.com/kubeflow/katib/katib-ui /app/
62+
COPY --from=frontend /src/dist/static /app/build/static/
63+
ENTRYPOINT ["./katib-ui"]

cmd/suggestion/chocolate/v1beta1/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ RUN if [ "$(uname -m)" = "ppc64le" ] || [ "$(uname -m)" = "aarch64" ]; then \
88
apt-get -y update && \
99
apt-get -y install gfortran libopenblas-dev liblapack-dev && \
1010
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/* && \
12-
pip install cython; \
11+
rm -rf /var/lib/apt/lists/*; \
1312
fi
1413
RUN if [ "$(uname -m)" = "ppc64le" ]; then \
1514
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-ppc64le; \
@@ -23,6 +22,9 @@ RUN if [ "$(uname -m)" = "ppc64le" ]; then \
2322
ADD ./pkg/ ${TARGET_DIR}/pkg/
2423
ADD ./${SUGGESTION_DIR}/ ${TARGET_DIR}/${SUGGESTION_DIR}/
2524
WORKDIR ${TARGET_DIR}/${SUGGESTION_DIR}
25+
RUN if [ "$(uname -m)" = "aarch64" ]; then \
26+
sed -i -e '$a git+https://github.com/fmder/ghalton@master' -e '/^ghalton/d' requirements.txt; \
27+
fi;
2628
RUN pip install --no-cache-dir -r requirements.txt
2729

2830
RUN chgrp -R 0 ${TARGET_DIR} \

cmd/suggestion/chocolate/v1beta1/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ googleapis-common-protos==1.6.0
99
SQLAlchemy==1.4.26
1010
git+https://github.com/AIworx-Labs/chocolate@master
1111
ghalton>=0.6.2
12+
cython>=0.29.24

cmd/suggestion/hyperband/v1beta1/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ RUN if [ "$(uname -m)" = "ppc64le" ] || [ "$(uname -m)" = "aarch64" ]; then \
88
apt-get -y update && \
99
apt-get -y install gfortran libopenblas-dev liblapack-dev && \
1010
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/* && \
12-
pip install cython; \
11+
rm -rf /var/lib/apt/lists/*; \
1312
fi
1413

1514
RUN if [ "$(uname -m)" = "ppc64le" ]; then \

cmd/suggestion/hyperband/v1beta1/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ scipy>=1.5.4
66
forestci==0.3
77
protobuf==3.19.1
88
googleapis-common-protos==1.6.0
9+
cython>=0.29.24

cmd/suggestion/hyperopt/v1beta1/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ RUN if [ "$(uname -m)" = "ppc64le" ] || [ "$(uname -m)" = "aarch64" ]; then \
88
apt-get -y update && \
99
apt-get -y install gfortran libopenblas-dev liblapack-dev && \
1010
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/* && \
12-
pip install cython; \
11+
rm -rf /var/lib/apt/lists/*; \
1312
fi
1413

1514
RUN if [ "$(uname -m)" = "ppc64le" ]; then \

0 commit comments

Comments
 (0)