diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 497ca177..31b453b5 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -34,17 +34,24 @@ jobs: with: tool-cache: false + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: all + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build and export + - name: Build and export multi-arch image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile tags: ${{ env.DEV_IMAGE }} + platforms: linux/amd64,linux/s390x # outputs: type=oci,dest=/tmp/image.tar outputs: type=docker,dest=/tmp/image.tar + provenance: false - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/Dockerfile.s390x b/Dockerfile.s390x new file mode 100644 index 00000000..dc00c800 --- /dev/null +++ b/Dockerfile.s390x @@ -0,0 +1,40 @@ +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as poetry-builder + +RUN microdnf -y update && \ + microdnf -y install \ + git wget shadow-utils python3.11 python3.11-pip python-wheel gcc gcc-c++ && \ + pip3.11 install --no-cache-dir --upgrade pip wheel && \ + microdnf clean all + +WORKDIR /caikit +RUN microdnf update -y +RUN wget -q -O miniconda.sh \ + https://repo.anaconda.com/miniconda/Miniconda3-py311_24.11.1-0-Linux-s390x.sh && \ + chmod 755 miniconda.sh && \ + echo 'export PATH=/opt/conda3/bin:$PATH' > /etc/profile.d/conda.sh && \ + /bin/bash miniconda.sh -b -p /opt/conda3 && \ + rm miniconda.sh && \ + . /etc/profile.d/conda.sh + +ENV PATH /opt/conda3/bin:$PATH +RUN ln -s /opt/conda3 /opt/conda +RUN conda config --add channels defaults +RUN conda install numpy==1.26.4 pandas==2.2.3 scikit-learn==1.6.1 pytorch==2.5.1 pyarrow==19.0.0 pillow +COPY grpcio-1.72.0.dev0-cp311-cp311-linux_s390x.whl /caikit +RUN pip install grpcio-1.72.0.dev0-cp311-cp311-linux_s390x.whl +COPY requirements.txt /caikit +RUN pip install -r requirements.txt + +COPY caikit.yml /caikit/config/caikit.yml + +RUN groupadd --system caikit --gid 1001 && \ + adduser --system --uid 1001 --gid 0 --groups caikit \ + --create-home --home-dir /caikit --shell /sbin/nologin \ + --comment "Caikit User" caikit + +USER caikit + +ENV CONFIG_FILES=/caikit/config/caikit.yml +VOLUME ["/caikit/config/"] + +CMD ["python", "-m", "caikit.runtime"] diff --git a/Makefile b/Makefile index dd3e0fa7..1ff51d81 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,22 @@ CAIKIT_IMAGE=caikit-tgis-serving ENGINE ?= podman -export DOCKER_DEFAULT_PLATFORM=linux/amd64 +ARCH ?= $(shell uname -m) +PLATFORM = linux/$(ARCH) + +ifeq ($(ARCH),s390x) + DOCKERFILE = Dockerfile.s390x +else + DOCKERFILE = Dockerfile +endif + +export DOCKER_DEFAULT_PLATFORM = $(PLATFORM) + .PHONY: default refresh-poetry-lock-files default: $(ENGINE) build \ + --platform=$(PLATFORM) \ + -f $(DOCKERFILE) \ -t $(CAIKIT_IMAGE):dev \ -t $(CAIKIT_IMAGE):$$(git rev-parse --short HEAD) \ . @@ -12,6 +24,7 @@ default: shell: default $(ENGINE) run -it --rm \ + --platform=$(PLATFORM) \ --name caikit-tgis-serving-test-$$(git rev-parse --short HEAD) \ $(CAIKIT_IMAGE):dev \ /bin/bash diff --git a/grpcio-1.72.0.dev0-cp311-cp311-linux_s390x.whl b/grpcio-1.72.0.dev0-cp311-cp311-linux_s390x.whl new file mode 100644 index 00000000..97986a96 Binary files /dev/null and b/grpcio-1.72.0.dev0-cp311-cp311-linux_s390x.whl differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..10bad786 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +caikit==0.27.7 +caikit-nlp==0.5.13 +caikit-tgis-backend==0.1.38