diff --git a/.dockerignore b/.dockerignore index 1f69b9c2..7350d411 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,7 +5,6 @@ .cache .dockerignore .env -.git .github .gitignore .idea diff --git a/Dockerfile b/Dockerfile index b0207a00..1c9cf748 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,7 @@ RUN --mount=type=cache,target=/root/.cache/microdnf:rw \ tar \ gzip \ maven \ + git \ && true # Install etcd -- used for CI tests @@ -74,6 +75,11 @@ ENV MAVEN_OPTS="-Dfile.encoding=UTF8" RUN --mount=type=cache,target=/root/.m2 \ mvn -B package -DskipTests=true --file pom.xml +# Assume that source code comes from a Git repository +RUN echo "$(date '+%Y%m%d')-$(git rev-parse HEAD | cut -c -5)" > target/dockerhome/build-version && \ + echo "$(git rev-parse HEAD)" > target/dockerhome/release && \ + 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 + ############################################################################### 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 \ # wait to create commit-specific LABEL until end of the build to not unnecessarily # invalidate the cached image layers -ARG imageVersion -ARG buildId -ARG commitSha +# ARG imageVersion +# ARG buildId +# ARG commitSha -RUN echo "${buildId}" > /opt/kserve/mmesh/build-version +# Generated at build stage +# RUN echo "${buildId}" > /opt/kserve/mmesh/build-version LABEL name="model-mesh" \ vendor="KServe" \ - version="${imageVersion}" \ +# version="${imageVersion}" \ summary="Core model-mesh sidecar image" \ description="Model-mesh is a distributed LRU cache for serving runtime models" \ - release="${commitSha}" \ +# release="${commitSha}" \ maintainer="nickhill@us.ibm.com" EXPOSE 8080