Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Dockerfile.konflux #22

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions Dockerfile.konflux
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

# Build arguments
ARG SOURCE_CODE=.

FROM registry.redhat.io/ubi8/go-toolset@sha256:4ec05fd5b355106cc0d990021a05b71bbfb9231e4f5bdc0c5316515edf6a1c96 AS stage
MohammadiIram marked this conversation as resolved.
Show resolved Hide resolved

# Define a build argument for the PNC list of built files
ARG PNC_FILES_JSON
RUN echo "Files to download: $PNC_FILES_JSON"

# Install packages for the install script and extract archives
RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y unzip jq wget
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need the rpm.in and lock files to be able to install it?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it to download files from PNC?

what about the konflux cache?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where the java bits is being built?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need the rpm.in and lock files to be able to install it?

yes, we have the rpm files added

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please clarify the other questions?


ENV STAGE_DIR="/tmp/artifacts"
WORKDIR $STAGE_DIR

# Filter the zip files only and unzip them in /root/
RUN echo "$PNC_FILES_JSON" | jq -r '.[] | select(test("\\.zip$"))' | \
while read url; do wget --no-check-certificate "$url"; done && \
for file in *.zip; do unzip -d /root/ "$file"; done


###############################################################################
FROM registry.redhat.io/ubi8/openjdk-17-runtime@sha256:e2f33a6c60db4f4e70882a4a557eec5890997f8a1be7e3eb8971a0ff8a45a1a8 as runtime
MohammadiIram marked this conversation as resolved.
Show resolved Hide resolved

## Build args to be used at this step
ARG USERID=2000

LABEL com.redhat.component="odh-modelmesh-container" \
name="managed-open-data-hub/odh-modelmesh-rhel8" \
description="Modelmesh is a distributed LRU cache for serving runtime models" \
summary="odh-modelmesh" \
maintainer="['[email protected]']" \
io.openshift.expose-services="" \
io.k8s.display-name="odh-modelmesh" \
io.k8s.description="odh-modelmesh" \
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"

USER root

RUN sed -i 's:security.provider.12=SunPKCS11:#security.provider.12=SunPKCS11:g' /usr/lib/jvm/java-17-openjdk-*/conf/security/java.security \
&& sed -i 's:#security.provider.1=SunPKCS11 ${java.home}/lib/security/nss.cfg:security.provider.12=SunPKCS11 ${java.home}/lib/security/nss.cfg:g' /usr/lib/jvm/java-17-openjdk-*/conf/security/java.security

ENV JAVA_HOME=/usr/lib/jvm/jre-17-openjdk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the base image already provides this env, IMHO, we don't need to set it here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok



COPY --from=stage root/target/dockerhome/ /opt/kserve/mmesh/
COPY --from=stage root/target/dockerhome/version /etc/modelmesh-version


# Make this the current directory when starting the container
WORKDIR /opt/kserve/mmesh

RUN microdnf install shadow-utils
MohammadiIram marked this conversation as resolved.
Show resolved Hide resolved
RUN useradd -c "Application User" -U -u ${USERID} -m app && \
chown -R app:0 /home/app && \
chmod g+w /etc/passwd && \
ln -s /opt/kserve/mmesh /opt/kserve/tas && \
mkdir -p log && \
chown -R app:0 . && \
chmod -R 771 . && chmod 775 *.sh *.py && \
echo "${CI_CONTAINER_VERSION}" > /opt/kserve/mmesh/build-version && \
sed -i 's/security.useSystemPropertiesFile=true/security.useSystemPropertiesFile=false/g' $JAVA_HOME/conf/security/java.security
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is to disable FIPS, do we want that?


EXPOSE 8080

# Run as non-root user by default, to allow runAsNonRoot:true without runAsUser
USER ${USERID}


# The command to run by default when the container is first launched
CMD ["sh", "-c", "exec /opt/kserve/mmesh/start.sh"]
Loading