Skip to content

Commit

Permalink
Parametrized docker build (kubeflow#2666)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Ableda <abledapeter@gmail.com>
  • Loading branch information
peterableda authored Apr 1, 2023
1 parent 8da610b commit 774f0c4
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 24 deletions.
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
HAS_LINT := $(shell command -v golint;)

# Base Image URL
BASE_IMG ?= python:3.9-slim-bullseye
AIX_BASE_IMG ?= python:3.7-slim
PMML_BASE_IMG ?= openjdk:11-slim

# Image URL to use all building/pushing image targets
IMG ?= kserve-controller:latest
AGENT_IMG ?= agent:latest
Expand Down Expand Up @@ -219,49 +224,49 @@ docker-push-router:
docker push ${KO_DOCKER_REPO}/${ROUTER_IMG}

docker-build-sklearn:
cd python && docker build -t ${KO_DOCKER_REPO}/${SKLEARN_IMG} -f sklearn.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${SKLEARN_IMG} -f sklearn.Dockerfile .

docker-push-sklearn: docker-build-sklearn
docker push ${KO_DOCKER_REPO}/${SKLEARN_IMG}

docker-build-xgb:
cd python && docker build -t ${KO_DOCKER_REPO}/${XGB_IMG} -f xgb.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${XGB_IMG} -f xgb.Dockerfile .

docker-push-xgb: docker-build-xgb
docker push ${KO_DOCKER_REPO}/${XGB_IMG}

docker-build-lgb:
cd python && docker build -t ${KO_DOCKER_REPO}/${LGB_IMG} -f lgb.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${LGB_IMG} -f lgb.Dockerfile .

docker-push-lgb: docker-build-lgb
docker push ${KO_DOCKER_REPO}/${LGB_IMG}

docker-build-pmml:
cd python && docker build -t ${KO_DOCKER_REPO}/${PMML_IMG} -f pmml.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${PMML_BASE_IMG} -t ${KO_DOCKER_REPO}/${PMML_IMG} -f pmml.Dockerfile .

docker-push-pmml: docker-build-pmml
docker push ${KO_DOCKER_REPO}/${PMML_IMG}

docker-build-paddle:
cd python && docker build -t ${KO_DOCKER_REPO}/${PADDLE_IMG} -f paddle.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${PADDLE_IMG} -f paddle.Dockerfile .

docker-push-paddle: docker-build-paddle
docker push ${KO_DOCKER_REPO}/${PADDLE_IMG}

docker-build-alibi:
cd python && docker build -t ${KO_DOCKER_REPO}/${ALIBI_IMG} -f alibiexplainer.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${ALIBI_IMG} -f alibiexplainer.Dockerfile .

docker-push-alibi: docker-build-alibi
docker push ${KO_DOCKER_REPO}/${ALIBI_IMG}

docker-build-aix:
cd python && docker build -t ${KO_DOCKER_REPO}/${AIX_IMG} -f aixexplainer.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${AIX_BASE_IMG} -t ${KO_DOCKER_REPO}/${AIX_IMG} -f aixexplainer.Dockerfile .

docker-push-aix: docker-build-aix
docker push ${KO_DOCKER_REPO}/${AIX_IMG}

docker-build-storageInitializer:
cd python && docker build -t ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG} -f storage-initializer.Dockerfile .
cd python && docker build --build-arg BASE_IMAGE=${BASE_IMG} -t ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG} -f storage-initializer.Dockerfile .

docker-push-storageInitializer: docker-build-storageInitializer
docker push ${KO_DOCKER_REPO}/${STORAGE_INIT_IMG}
Expand Down
3 changes: 2 additions & 1 deletion python/aiffairness.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/aixexplainer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.7-slim
ARG BASE_IMAGE=python:3.7-slim
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/alibiexplainer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/artexplainer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
5 changes: 3 additions & 2 deletions python/custom_model.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand All @@ -7,7 +8,7 @@ COPY VERSION VERSION
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -e ./kserve

COPY custom_model custom_model
RUN pip install -r ./custom_model/requirements.txt
RUN pip install -r ./custom_model/requirements.txt

RUN useradd kserve -m -u 1000 -d /home/kserve
USER 1000
Expand Down
3 changes: 2 additions & 1 deletion python/custom_model_grpc.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/custom_transformer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/custom_transformer_grpc.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/lgb.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/paddle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
3 changes: 2 additions & 1 deletion python/pmml.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM openjdk:11-slim
ARG BASE_IMAGE=openjdk:11-slim
FROM $BASE_IMAGE

ARG PYTHON_VERSION=3.9
ARG CONDA_PYTHON_VERSION=3
Expand Down
3 changes: 2 additions & 1 deletion python/sklearn.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down
5 changes: 3 additions & 2 deletions python/storage-initializer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

ARG DEBIAN_FRONTEND=noninteractive

Expand All @@ -12,7 +13,7 @@ RUN apt-get update && apt-get install -y \
gcc \
libkrb5-dev \
krb5-config \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir krbcontext==0.10 hdfs~=2.6.0 requests-kerberos==0.14.0

Expand Down
3 changes: 2 additions & 1 deletion python/xgb.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9-slim-bullseye
ARG BASE_IMAGE=python:3.9-slim-bullseye
FROM $BASE_IMAGE

COPY third_party third_party

Expand Down

0 comments on commit 774f0c4

Please sign in to comment.