Skip to content

Commit ecf3b47

Browse files
committed
Merge remote-tracking branch 'upstream/release-0.12.0-rc0'
2 parents f2fccfd + 7b78ee1 commit ecf3b47

File tree

4 files changed

+92
-14
lines changed

4 files changed

+92
-14
lines changed

Dockerfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# Stage 1: Create the developer image for the BUILDPLATFORM only
1717
###############################################################################
1818
ARG GOLANG_VERSION=1.21
19+
ARG BUILD_BASE=develop
1920
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:$GOLANG_VERSION AS develop
2021

2122
ARG PROTOC_VERSION=21.5
@@ -77,6 +78,8 @@ RUN set -eux; \
7778
WORKDIR /opt/app
7879

7980
COPY go.mod go.sum ./
81+
# Download dependencies before copying the source so they will be cached
82+
RUN go mod download
8083

8184
# Install go protoc plugins
8285
# no required module provides package google.golang.org/grpc/cmd/protoc-gen-go-grpc
@@ -98,8 +101,6 @@ RUN git init && \
98101
git config --global --add safe.directory "*" && \
99102
rm -rf .git
100103

101-
# Download dependencies before copying the source so they will be cached
102-
RUN go mod download
103104

104105
# the ubi/go-toolset image doesn't define ENTRYPOINT or CMD, but we need it to run 'make develop'
105106
CMD /bin/bash
@@ -108,10 +109,18 @@ CMD /bin/bash
108109
###############################################################################
109110
# Stage 2: Run the go build with BUILDPLATFORM's native go compiler
110111
###############################################################################
111-
FROM --platform=$BUILDPLATFORM develop AS build
112+
FROM --platform=$BUILDPLATFORM $BUILD_BASE AS build
112113

113114
LABEL image="build"
114115

116+
USER root
117+
118+
# needed for konflux as the previous stage is not used
119+
WORKDIR /opt/app
120+
COPY go.mod go.sum ./
121+
# Download dependencies before copying the source so they will be cached
122+
RUN go mod download
123+
115124
# Copy the source
116125
COPY . ./
117126

@@ -146,7 +155,7 @@ USER root
146155
# install python to convert keras to tf
147156
# NOTE: tensorflow not supported on PowerPC (ppc64le) or System Z (s390x) https://github.com/tensorflow/tensorflow/issues/46181
148157
RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
149-
microdnf install --setopt=cachedir=/root/.cache/microdnf \
158+
microdnf install --setopt=cachedir=/root/.cache/microdnf --setopt=ubi-8-appstream-rpms.module_hotfixes=1 \
150159
gcc \
151160
gcc-c++ \
152161
python38-devel \
@@ -157,17 +166,11 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
157166

158167
# need to upgrade pip and install wheel before installing grpcio, before installing tensorflow on aarch64
159168
# use caching to speed up multi-platform builds
169+
COPY requirements.txt requirements.txt
160170
ENV PIP_CACHE_DIR=/root/.cache/pip
161171
RUN --mount=type=cache,target=/root/.cache/pip \
162-
pip install --upgrade pip && \
163-
pip install wheel && \
164-
pip install grpcio && \
165-
# pin to 3.10.0 to avoid error: libhdf5.so: cannot open shared object file: No such file or directory \
166-
# if not version is set, it will install the 3.11.0 version which, seems that does not have the h5py dependencies \
167-
# for arm yet.
168-
pip install h5py==3.10.0 && \
169-
pip install tensorflow
170-
172+
pip install -r requirements.txt
173+
RUN rm -rfv requirements.txt
171174
USER ${USER}
172175

173176
# Add modelmesh version

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ all: build
2727
.PHONY: build
2828
## Build runtime Docker image
2929
build:
30-
./scripts/build_docker.sh --target runtime
30+
./scripts/build_docker.sh --target builder --target runtime
3131

3232
.PHONY: build.develop
3333
## Build developer container image

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,33 @@ modelmesh-controller-64f5c8d6d6-k6rzc kserve/modelmesh-controller:lat
194194
modelmesh-serving-mlserver-1.x-84884c6849-s8dw6 kserve/rest-proxy:latest, seldonio/mlserver:1.3.2, your-docker-userid/modelmesh-runtime-adapter:dev, kserve/modelmesh:latest
195195
modelmesh-serving-mlserver-1.x-84884c6849-xpdw4 kserve/rest-proxy:latest, seldonio/mlserver:1.3.2, your-docker-userid/modelmesh-runtime-adapter:dev, kserve/modelmesh:latest
196196
```
197+
198+
# Konflux build system Files
199+
200+
This directory holds the requirements.txt file use in the Konflux builds to pre-fetch the required packages.
201+
202+
Here are two files that we need to keep:
203+
204+
- **requirements.txt**: is the result of the `pip freeze` command (see example below).
205+
206+
## How to update the requirements.txt file
207+
208+
Once the final container is built, you can access it:
209+
210+
```bash
211+
podman run <modelmesh-runtime-adapter-container-name> sh -c 'pip freeze'
212+
```
213+
214+
Note, for `tensorflow-io-gcs-filesystem` it must be pinned to **0.34.0** manually after generating the `requirements.txt` file.`
215+
216+
Then commit the changes and push.
217+
218+
# Konflux configuration
219+
220+
Build configuration, it requires the build be configured as follows:
221+
222+
```yaml
223+
- name: prefetch-input
224+
value: |
225+
[{"type": "gomod"}, {"type": "rpm"}, {"type": "pip", "path": ".", "requirements_files": ["requirements.txt"], "allow_binary": "true"}]
226+
```

requirements.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
absl-py==2.1.0
2+
astunparse==1.6.3
3+
cachetools==5.5.0
4+
certifi==2024.8.30
5+
charset-normalizer==3.3.2
6+
flatbuffers==24.3.25
7+
gast==0.4.0
8+
google-auth==2.34.0
9+
google-auth-oauthlib==1.0.0
10+
google-pasta==0.2.0
11+
grpcio==1.66.1
12+
# pin to 3.10.0 to avoid error: libhdf5.so: cannot open shared object file: No such file or directory \
13+
# if not version is set, it will install the 3.11.0 version which, seems that does not have the h5py dependencies \
14+
# for arm yet.
15+
h5py==3.10.0
16+
idna==3.8
17+
importlib-metadata==8.4.0
18+
keras==2.13.1
19+
libclang==18.1.1
20+
Markdown==3.7
21+
MarkupSafe==2.1.5
22+
numpy==1.24.3
23+
oauthlib==3.2.2
24+
opt-einsum==3.3.0
25+
packaging==24.1
26+
protobuf==4.25.4
27+
pyasn1==0.6.0
28+
pyasn1-modules==0.4.0
29+
requests==2.32.3
30+
requests-oauthlib==2.0.0
31+
rsa==4.9
32+
six==1.16.0
33+
tensorboard==2.13.0
34+
tensorboard-data-server==0.7.2
35+
tensorflow==2.13.1
36+
tensorflow-estimator==2.13.0
37+
# Note, for `tensorflow-io-gcs-filesystem` it must be pinned to 0.34.0 manually after generating the `requirements.txt` file.
38+
tensorflow-io-gcs-filesystem==0.34.0
39+
termcolor==2.4.0
40+
typing-extensions==4.5.0
41+
urllib3==2.2.2
42+
werkzeug==3.0.4
43+
wheel==0.44.0
44+
wrapt==1.16.0
45+
zipp==3.20.1

0 commit comments

Comments
 (0)