Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
che #13454 Adding Che 7 java 11 community images with support of arbi…
Browse files Browse the repository at this point in the history
…trary user to make them OpenShift compatible

Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
  • Loading branch information
ibuziuk committed Jul 10, 2019
1 parent 916fee5 commit 878e574
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arbitrary-users-patch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG FROM_IMAGE
FROM ${FROM_IMAGE}
USER 0
RUN chmod g=u /etc/passwd
COPY [--chown=0:0] entrypoint.sh /
RUN chmod +x entrypoint.sh

USER 10001
ENV HOME /home/user
WORKDIR /projects
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["sleep", "infinity"]
1 change: 1 addition & 0 deletions arbitrary-users-patch/base_images
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java11-maven maven:3.6.0-jdk-11
12 changes: 12 additions & 0 deletions arbitrary-users-patch/build_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e

DEFAULT_REGISTRY="quay.io"
REGISTRY=${REGISTRY:-${DEFAULT_REGISTRY}}

while read -r line; do
base_image_name=$(echo $line | cut -f 1 -d ' ')
base_image=$(echo $line | cut -f 2 -d ' ')
echo "Building ${REGISTRY}/eclipse-che/che7-${base_image_name} based on $base_image ..."
docker build -t "${REGISTRY}/eclipse-che/che7-${base_image_name}" --build-arg FROM_IMAGE=$base_image .
done < base_images
7 changes: 7 additions & 0 deletions arbitrary-users-patch/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-user}:x:$(id -u):0:${USER_NAME:-user} user:${HOME}:/bin/bash" >> /etc/passwd
fi
fi
exec "$@"

0 comments on commit 878e574

Please sign in to comment.