Skip to content

Commit

Permalink
add Python38 wrapper image + cleanup of image build process
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski committed Aug 9, 2021
1 parent d221f0e commit 8556ecb
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 83 deletions.
12 changes: 8 additions & 4 deletions wrappers/s2i/python/Dockerfile
@@ -1,16 +1,20 @@
ARG CONDA_VERSION
ARG BASE_IMAGE
ARG IMAGE_VERSION
FROM $BASE_IMAGE:$IMAGE_VERSION

LABEL io.openshift.s2i.scripts-url="image:///s2i/bin"

# This is to install desired version of Python without updating conda version
# Note: ARGs must be after FROM statement , see source:
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact

ARG PYTHON_VERSION
ARG CONDA_VERSION

RUN conda install --yes python=$PYTHON_VERSION conda=$CONDA_VERSION
RUN dnf install -y make automake gcc gcc-c++

# Upgrade pip version
# Pin pip and setuptools
RUN pip install pip==20.2 setuptools==46.1

RUN mkdir microservice
Expand All @@ -19,10 +23,10 @@ WORKDIR /microservice
COPY ./s2i/bin/ /s2i/bin

# keep install of seldon-core after the COPY to force re-build of layer
COPY requirements.txt ./requirements.txt
COPY version.txt /microservice/version.txt
COPY _python/python/licenses/license.txt .
RUN pip install -r requirements.txt
COPY _python /microservice
RUN cd /microservice/python && pip install .

RUN mkdir -p /.conda && chmod a+rwx /.conda
RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical
Expand Down
34 changes: 0 additions & 34 deletions wrappers/s2i/python/Dockerfile.local

This file was deleted.

19 changes: 5 additions & 14 deletions wrappers/s2i/python/Makefile
Expand Up @@ -2,7 +2,7 @@ IMAGE_VERSION := $(shell cat ../../../version.txt)
SHELL:=/bin/bash

PYTHON_VERSION=3.7.10
CONDA_VERSION=4.7.12
CONDA_VERSION=4.10.3
IMAGE_PYTHON_VERSION=`echo -n $(PYTHON_VERSION) | cut -d. -f1-2 | sed 's/\.//g'`
DEFAULT_IMAGE_PYTHON_VERSION=`echo -n $(PYTHON_VERSION) | cut -d. -f1`
IMAGE_NAME = docker.io/seldonio/seldon-core-s2i-python${IMAGE_PYTHON_VERSION}
Expand All @@ -21,23 +21,15 @@ get_local_repo:
cp ../../../version.txt version.txt
cp -r $(SELDON_CORE_DIR)/python _python


.PHONY: build
build: get_local_repo
set -x && docker build -f Dockerfile --build-arg IMAGE_VERSION=${IMAGE_VERSION} --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} --build-arg BASE_IMAGE=${CONDA_BASE_IMAGE} -t $(IMAGE_NAME):$(IMAGE_VERSION) .
set -x && docker build -f Dockerfile.local --build-arg IMAGE_VERSION=${IMAGE_VERSION} --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} --build-arg BASE_IMAGE=${CONDA_BASE_IMAGE} -t $(IMAGE_NAME):$(IMAGE_VERSION) .
docker tag $(IMAGE_NAME):$(IMAGE_VERSION) $(IMAGE_NAME)-ubi8:$(IMAGE_VERSION)

.PHONY: build_gpu
build_gpu: get_local_repo
docker build -f Dockerfile.gpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} -t ${GPU_IMAGE_NAME}:${IMAGE_VERSION} .

.PHONY: build_local
build_local: get_local_repo
set -x && docker build -f Dockerfile.local --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} --build-arg BASE_IMAGE=${CONDA_BASE_IMAGE} --build-arg IMAGE_VERSION=${IMAGE_VERSION} -t $(IMAGE_NAME):$(IMAGE_VERSION) .


.PHONY: build_redhat
build_redhat: get_local_repo
set -x && docker build -f Dockerfile.local --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} --build-arg BASE_IMAGE=${CONDA_BASE_IMAGE} --build-arg IMAGE_VERSION=${IMAGE_VERSION} -t $(IMAGE_NAME)-ubi8:$(IMAGE_VERSION) .
set -x && docker build -f Dockerfile.gpu --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg CONDA_VERSION=${CONDA_VERSION} -t ${GPU_IMAGE_NAME}:${IMAGE_VERSION} .


tag_base_python:
Expand All @@ -48,10 +40,9 @@ push_to_dockerhub_base_python:

push_to_dockerhub:
docker push $(IMAGE_NAME):$(IMAGE_VERSION)

push_redhat_to_dockerhub:
docker push $(IMAGE_NAME)-ubi8:$(IMAGE_VERSION)


push_gpu_to_dockerhub:
docker push ${GPU_IMAGE_NAME}:${IMAGE_VERSION}

Expand Down
21 changes: 15 additions & 6 deletions wrappers/s2i/python/build_scripts/build_all.sh 100755 → 100644
@@ -1,6 +1,15 @@
./build_conda_base.sh
./build_python3.6.sh
./build_python3.6_gpu.sh
./build_python3.7.sh
./build_python3.7_gpu.sh
./build_redhat.sh
# Build base conda image
make -C ../ build_conda_base

# Build standard wrapper images
make -C ../ build PYTHON_VERSION=3.6
make -C ../ build PYTHON_VERSION=3.7.10
make -C ../ build PYTHON_VERSION=3.8.11

# Tag the default image
make -C ../ tag_base_python PYTHON_VERSION=3.7.10

# Build GPU images
make -C ../ build_gpu PYTHON_VERSION=3.6
make -C ../ build_gpu PYTHON_VERSION=3.7.10
make -C ../ build_gpu PYTHON_VERSION=3.8.11
1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/build_conda_base.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/build_local_python3.6.sh

This file was deleted.

2 changes: 0 additions & 2 deletions wrappers/s2i/python/build_scripts/build_local_python3.7.sh

This file was deleted.

2 changes: 0 additions & 2 deletions wrappers/s2i/python/build_scripts/build_python3.6.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/build_python3.6_gpu.sh

This file was deleted.

2 changes: 0 additions & 2 deletions wrappers/s2i/python/build_scripts/build_python3.7.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/build_python3.7_gpu.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/build_redhat.sh

This file was deleted.

21 changes: 15 additions & 6 deletions wrappers/s2i/python/build_scripts/push_all.sh 100755 → 100644
@@ -1,6 +1,15 @@
./push_conda_base.sh
./push_python3.6.sh
./push_python3.7.sh
./push_python3.6_gpu.sh
./push_python3.7_gpu.sh
./push_redhat.sh
# Push base conda image
make -C ../ push_to_dockerhub_conda_base

# Push standard wrapper images
make -C ../ push_to_dockerhub PYTHON_VERSION=3.6
make -C ../ push_to_dockerhub PYTHON_VERSION=3.7.10
make -C ../ push_to_dockerhub PYTHON_VERSION=3.8.11

# Push default tag image
make -C ../ push_to_dockerhub_base_python PYTHON_VERSION=3.7.10

# Push GPU images
make -C ../ push_gpu_to_dockerhub PYTHON_VERSION=3.6
make -C ../ push_gpu_to_dockerhub PYTHON_VERSION=3.7.10
make -C ../ push_gpu_to_dockerhub PYTHON_VERSION=3.8.11
1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/push_conda_base.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/push_python3.6.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/push_python3.6_gpu.sh

This file was deleted.

2 changes: 0 additions & 2 deletions wrappers/s2i/python/build_scripts/push_python3.7.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/push_python3.7_gpu.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/build_scripts/push_redhat.sh

This file was deleted.

1 change: 0 additions & 1 deletion wrappers/s2i/python/requirements.txt

This file was deleted.

0 comments on commit 8556ecb

Please sign in to comment.