-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto UID/GID, gosu and user entrypoint
- Loading branch information
Showing
14 changed files
with
91 additions
and
62 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
apt-get update -qq | ||
apt-get install -yq --no-install-recommends \ | ||
python-dev \ | ||
python-tk | ||
apt-get clean |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Add local user | ||
# Either use runtime USER_ID:GROUP_ID or fallback 1000:1000 | ||
|
||
USER_ID=${USER_ID:-1000} | ||
GROUP_ID=${GROUP_ID:-1000} | ||
mainUser=${mainUser:-sirfuser} | ||
OLD_HOME=/home-away | ||
export HOME=/home/$mainUser | ||
|
||
cd / | ||
mv $OLD_HOME $HOME | ||
cd $HOME | ||
|
||
echo "$UID:$GID Creating and switching to: $mainUser:$USER_ID:$GROUP_ID" | ||
# groupadd -g $GROUP_ID -o -f $mainUser | ||
addgroup --system --gid "$GROUP_ID" "$mainUser" | ||
# useradd --shell /bin/bash -u $USER_ID -o -c "" -M -d $HOME \ | ||
# -g $mainUser -G sudo $mainUser \ | ||
# -p $(echo somepassword | openssl passwd -1 -stdin) | ||
adduser --system --shell /bin/bash --no-create-home --home /home/"$mainUser" \ | ||
--ingroup "$mainUser" --uid "$USER_ID" "$mainUser" | ||
|
||
echo "$mainUser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/"$mainUser" | ||
|
||
for i in /opt/* "$HOME"; do | ||
if [ -d "$i" ]; then | ||
chown -R $mainUser "$i" | ||
chgrp -R $mainUser "$i" | ||
fi | ||
done | ||
|
||
exec gosu $mainUser "$@" |
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,11 +1,16 @@ | ||
#!/usr/bin/env bash | ||
[ -f .bashrc ] && . .bashrc | ||
INSTALL_DIR="${1:-/opt/pyvenv}" | ||
|
||
# Python (virtualenv) | ||
curl -O https://bootstrap.pypa.io/get-pip.py | ||
python get-pip.py --user | ||
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py | ||
python2 get-pip.py | ||
rm get-pip.py | ||
python -m pip install -U --user pip virtualenv | ||
python -m virtualenv ~/py2 | ||
export PIPINST="$HOME/py2/bin/pip install -U" | ||
python2 -m pip install -U pip virtualenv | ||
python2 -m virtualenv "$INSTALL_DIR" | ||
source "$INSTALL_DIR"/bin/activate | ||
|
||
# Python (runtime) | ||
$PIPINST -r requirements.txt | ||
if [ -f requirements.txt ]; then | ||
pip install -U -r requirements.txt | ||
fi |
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