Skip to content

Commit 1d2deb3

Browse files
authored
Merge pull request opendatahub-io#32 from israel-hdez/fix-for-ci-build
Adjust Dockerfile to be more friendly with openshift-ci
2 parents 7f33789 + b63cb9b commit 1d2deb3

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
.cache
66
.dockerignore
77
.env
8-
.git
98
.github
109
.gitignore
1110
.idea

Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
4444
tar \
4545
gzip \
4646
maven \
47+
git \
4748
&& true
4849

4950
# Install etcd -- used for CI tests
@@ -74,6 +75,11 @@ ENV MAVEN_OPTS="-Dfile.encoding=UTF8"
7475
RUN --mount=type=cache,target=/root/.m2 \
7576
mvn -B package -DskipTests=true --file pom.xml
7677

78+
# Assume that source code comes from a Git repository
79+
RUN echo "$(date '+%Y%m%d')-$(git rev-parse HEAD | cut -c -5)" > target/dockerhome/build-version && \
80+
echo "$(git rev-parse HEAD)" > target/dockerhome/release && \
81+
echo "$(git branch --show-current|sed 's/^release-//g')-$(git branch --show-current)_$(date '+%Y%m%d')-$(git rev-parse HEAD | cut -c -5)" > target/dockerhome/version
82+
7783

7884
###############################################################################
7985
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6 AS runtime
@@ -124,18 +130,19 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \
124130

125131
# wait to create commit-specific LABEL until end of the build to not unnecessarily
126132
# invalidate the cached image layers
127-
ARG imageVersion
128-
ARG buildId
129-
ARG commitSha
133+
# ARG imageVersion
134+
# ARG buildId
135+
# ARG commitSha
130136

131-
RUN echo "${buildId}" > /opt/kserve/mmesh/build-version
137+
# Generated at build stage
138+
# RUN echo "${buildId}" > /opt/kserve/mmesh/build-version
132139

133140
LABEL name="model-mesh" \
134141
vendor="KServe" \
135-
version="${imageVersion}" \
142+
# version="${imageVersion}" \
136143
summary="Core model-mesh sidecar image" \
137144
description="Model-mesh is a distributed LRU cache for serving runtime models" \
138-
release="${commitSha}" \
145+
# release="${commitSha}" \
139146
maintainer="[email protected]"
140147

141148
EXPOSE 8080

0 commit comments

Comments
 (0)