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

Fix clone and yo in Theia image #10960

Merged
2 commits merged into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions dockerfiles/theia/src/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
set -e
set -u

for f in "/etc/passwd" "/etc/group"; do
chgrp -R 0 ${f}
chmod -R g+rwX ${f};
done
# Generate passwd.template
cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/bash#g > ${HOME}/passwd.template
# Generate group.template
cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template


# Install basic software used for checking github API rate limit
yum install -y epel-release
yum -y install curl jq expect
Expand Down
18 changes: 18 additions & 0 deletions dockerfiles/theia/src/start.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)

if ! grep -Fq "${USER_ID}" /etc/passwd; then
# current user is an arbitrary
# user (its uid is not in the
# container /etc/passwd). Let's fix that
cat ${HOME}/passwd.template | \
sed "s/\${USER_ID}/${USER_ID}/g" | \
sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \
sed "s/\${HOME}/\/home\/theia/g" > /etc/passwd

cat ${HOME}/group.template | \
sed "s/\${USER_ID}/${USER_ID}/g" | \
sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \
sed "s/\${HOME}/\/home\/theia/g" > /etc/group
fi

if [ -z "$THEIA_PORT" ]; then
export THEIA_PORT=3000
else
Expand Down