16
16
# Stage 1: Create the developer image for the BUILDPLATFORM only
17
17
# ##############################################################################
18
18
ARG GOLANG_VERSION=1.21
19
+ ARG BUILD_BASE=develop
19
20
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:$GOLANG_VERSION AS develop
20
21
21
22
ARG PROTOC_VERSION=21.5
@@ -77,6 +78,8 @@ RUN set -eux; \
77
78
WORKDIR /opt/app
78
79
79
80
COPY go.mod go.sum ./
81
+ # Download dependencies before copying the source so they will be cached
82
+ RUN go mod download
80
83
81
84
# Install go protoc plugins
82
85
# no required module provides package google.golang.org/grpc/cmd/protoc-gen-go-grpc
@@ -98,8 +101,6 @@ RUN git init && \
98
101
git config --global --add safe.directory "*" && \
99
102
rm -rf .git
100
103
101
- # Download dependencies before copying the source so they will be cached
102
- RUN go mod download
103
104
104
105
# the ubi/go-toolset image doesn't define ENTRYPOINT or CMD, but we need it to run 'make develop'
105
106
CMD /bin/bash
@@ -108,10 +109,18 @@ CMD /bin/bash
108
109
# ##############################################################################
109
110
# Stage 2: Run the go build with BUILDPLATFORM's native go compiler
110
111
# ##############################################################################
111
- FROM --platform=$BUILDPLATFORM develop AS build
112
+ FROM --platform=$BUILDPLATFORM $BUILD_BASE AS build
112
113
113
114
LABEL image="build"
114
115
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
+
115
124
# Copy the source
116
125
COPY . ./
117
126
@@ -146,7 +155,7 @@ USER root
146
155
# install python to convert keras to tf
147
156
# NOTE: tensorflow not supported on PowerPC (ppc64le) or System Z (s390x) https://github.com/tensorflow/tensorflow/issues/46181
148
157
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 \
150
159
gcc \
151
160
gcc-c++ \
152
161
python38-devel \
@@ -157,17 +166,11 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
157
166
158
167
# need to upgrade pip and install wheel before installing grpcio, before installing tensorflow on aarch64
159
168
# use caching to speed up multi-platform builds
169
+ COPY requirements.txt requirements.txt
160
170
ENV PIP_CACHE_DIR=/root/.cache/pip
161
171
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
171
174
USER ${USER}
172
175
173
176
# Add modelmesh version
0 commit comments