This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch all used images for arbitrary users on OpenShift (#38)
* Patch all used images for arbitrary users on OpenShift - Patch all currently used images for arbitrary user support - Move $HOME and $PS1 definition into arbitrary user patch to simplify devfiles and make UX more consistent - Add additional fixes to patched images: - Set chmod g=u on /home to allow write access - Create home directory if it does not exist Signed-off-by: Angel Misevski <[email protected]>
- Loading branch information
Showing
19 changed files
with
80 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
ARG FROM_IMAGE | ||
FROM ${FROM_IMAGE} | ||
USER 0 | ||
RUN chmod g=u /etc/passwd | ||
# Set permissions on /etc/passwd and /home to allow arbitrary users to write | ||
RUN chmod g=u /etc/passwd /home | ||
COPY [--chown=0:0] entrypoint.sh / | ||
RUN chmod +x entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
USER 10001 | ||
ENV HOME /home/user | ||
ENV HOME=/home/user | ||
WORKDIR /projects | ||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD ["sleep", "infinity"] | ||
CMD ["tail", "-f", "/dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
java11-maven maven:3.6.0-jdk-11 | ||
che-python-3.6 centos/python-36-centos7:1 | ||
che-php-7 eclipse/php:7.1-che7 | ||
che-golang-1.10 golang:1.10.7-stretch | ||
che-java11-gradle gradle:5.2.1-jdk11 | ||
che-java11-maven maven:3.6.0-jdk-11 | ||
che-java8-maven maven:3.6.1-jdk-8 | ||
che-dotnet-2.2 mcr.microsoft.com/dotnet/core/sdk:2.2-stretch | ||
che-nodejs10-alpine node:10.16-alpine | ||
che-nodejs10-ubi registry.access.redhat.com/ubi8/nodejs-10 | ||
che-nodejs8-centos registry.centos.org/che-stacks/centos-nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2012-2018 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) | ||
|
||
DEFAULT_REGISTRY="quay.io" | ||
DEFAULT_ORGANIZATION="eclipse" | ||
DEFAULT_TAG="nightly" | ||
|
||
REGISTRY=${REGISTRY:-${DEFAULT_REGISTRY}} | ||
ORGANIZATION=${ORGANIZATION:-${DEFAULT_ORGANIZATION}} | ||
TAG=${TAG:-${DEFAULT_TAG}} | ||
|
||
NAME_FORMAT="${REGISTRY}/${ORGANIZATION}" | ||
|
||
PUSH_IMAGES=false | ||
if [ "$1" == "--push" ]; then | ||
PUSH_IMAGES=true | ||
fi | ||
|
||
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 | ||
base_image_name=$(echo "$line" | tr -s ' ' | cut -f 1 -d ' ') | ||
base_image=$(echo "$line" | tr -s ' ' | cut -f 2 -d ' ') | ||
echo "Building ${NAME_FORMAT}/${base_image_name}:${TAG} based on $base_image ..." | ||
docker build -t "${NAME_FORMAT}/${base_image_name}:${TAG}" --build-arg FROM_IMAGE="$base_image" "${SCRIPT_DIR}"/ | ||
if ${PUSH_IMAGES}; then | ||
echo "Pushing ${NAME_FORMAT}/${base_image_name}:${TAG}" to remote registry | ||
docker push "${NAME_FORMAT}/${base_image_name}:${TAG}" | ||
fi | ||
done < "${SCRIPT_DIR}"/base_images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# Ensure $HOME exists when starting | ||
if [ ! -d "${HOME}" ]; then | ||
mkdir -p "${HOME}" | ||
fi | ||
|
||
# Setup $PS1 for a consistent and reasonable prompt | ||
if [ ! -f "${HOME}"/.bashrc ]; then | ||
echo "PS1='\s-\v \w \$ '" > "${HOME}"/.bashrc | ||
fi | ||
|
||
# Add current (arbitrary) user to /etc/passwd | ||
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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters