From ffd4900af9ffd1e839f4ef9f0540001cdebee63b Mon Sep 17 00:00:00 2001 From: Spolti Date: Mon, 2 Sep 2024 11:44:48 -0300 Subject: [PATCH] [RHOAIENG-11349] - Missing requirements.txt for modelmesh-runtime-adapter component chore: Adapt Dockerfile to work on Konflux. Signed-off-by: Spolti --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8d0b3c13..87f14362 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,8 +76,6 @@ RUN set -eux; \ WORKDIR /opt/app -COPY go.mod go.sum ./ - # Install go protoc plugins # no required module provides package google.golang.org/grpc/cmd/protoc-gen-go-grpc # to add it run `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc` @@ -98,8 +96,6 @@ RUN git init && \ git config --global --add safe.directory "*" && \ rm -rf .git -# Download dependencies before copying the source so they will be cached -RUN go mod download # the ubi/go-toolset image doesn't define ENTRYPOINT or CMD, but we need it to run 'make develop' CMD /bin/bash @@ -112,6 +108,12 @@ FROM --platform=$BUILDPLATFORM develop AS build LABEL image="build" +WORKDIR /opt/app + +COPY go.mod go.sum ./ +# Download dependencies before copying the source so they will be cached +RUN go mod download + # Copy the source COPY . ./ @@ -123,9 +125,7 @@ ARG TARGETARCH # Build the binaries using native go compiler from BUILDPLATFORM but compiled output for TARGETPLATFORM # https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/ -RUN --mount=type=cache,target=/root/.cache/go-build \ - --mount=type=cache,target=/go/pkg \ - export GOOS=${TARGETOS:-linux} && \ +RUN export GOOS=${TARGETOS:-linux} && \ export GOARCH=${TARGETARCH:-amd64} && \ go build -o puller model-serving-puller/main.go && \ go build -o triton-adapter model-mesh-triton-adapter/main.go && \ @@ -151,6 +151,8 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \ gcc-c++ \ python38-devel \ python38 \ + # validates if it still needed in the builder iamge. + nodejs \ && ln -sf /usr/bin/python3 /usr/bin/python \ && ln -sf /usr/bin/pip3 /usr/bin/pip \ && true @@ -158,14 +160,12 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \ # need to upgrade pip and install wheel before installing grpcio, before installing tensorflow on aarch64 # use caching to speed up multi-platform builds ENV PIP_CACHE_DIR=/root/.cache/pip -RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --upgrade pip && \ - pip install wheel && \ - pip install grpcio && \ +RUN pip install grpcio && \ # pin to 3.10.0 to avoid error: libhdf5.so: cannot open shared object file: No such file or directory \ # if not version is set, it will install the 3.11.0 version which, seems that does not have the h5py dependencies \ # for arm yet. pip install h5py==3.10.0 && \ + pip install tensorflow-io-gcs-filesystem==0.34.0 && \ pip install tensorflow USER ${USER}