Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolosapio committed Oct 3, 2023
1 parent 41950d5 commit 0c8fed4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-docker-outside-of-docker",
"id": "alpine-docker-outside-of-docker",
"version": "0.0.6",
"version": "0.0.7",
"description": "Re-use the host docker socket, adding the Docker CLI to alpine container",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-docker-outside-of-docker",
"legacyIds": [
Expand Down
25 changes: 15 additions & 10 deletions src/alpine-docker-outside-of-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ apk add --no-cache docker

CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)
echo "CURRENT_USER is $CURRENT_USER"
echo "HOST_DOCKER_GID is $HOSTDOCKERGID"

HOST_DOCKER_GROUP=$(getent group $HOSTDOCKERGID | cut -d: -f1)

if [[ -z $HOST_DOCKER_GROUP ]]; then
echo "HOST_DOCKER_GROUP is empty, creating new group 'host-docker'"
addgroup -g $HOSTDOCKERGID host-docker
HOST_DOCKER_GROUP=host-docker
if [[ -z $CURRENT_USER ]]; then
echo "CURRENT_USER is empty, using 'root'"
else
echo "HOST_DOCKER_GROUP is already used, using existing group '$HOST_DOCKER_GROUP'"
fi
echo "HOST_DOCKER_GID is $HOSTDOCKERGID"

HOST_DOCKER_GROUP=$(getent group $HOSTDOCKERGID | cut -d: -f1)

addgroup $CURRENT_USER $HOST_DOCKER_GROUP
if [[ -z $HOST_DOCKER_GROUP ]]; then
echo "HOST_DOCKER_GROUP is empty, creating new group 'host-docker'"
addgroup -g $HOSTDOCKERGID host-docker
HOST_DOCKER_GROUP=host-docker
else
echo "HOST_DOCKER_GROUP is already used, using existing group '$HOST_DOCKER_GROUP'"
fi

addgroup $CURRENT_USER $HOST_DOCKER_GROUP
fi

if [[ $INSTALLDOCKERCOMPOSE == "true" ]]; then
apk add --no-cache docker-compose
Expand Down
2 changes: 1 addition & 1 deletion src/alpine-ohmyzsh/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-ohmyzsh",
"id": "alpine-ohmyzsh",
"version": "0.0.7",
"version": "0.0.8",
"description": "Installs ohmyzsh on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-ohmyzsh",
"options": {
Expand Down
4 changes: 4 additions & 0 deletions src/alpine-ohmyzsh/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ apk --no-cache add git curl zsh
CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)
su -c "curl -s https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s" $CURRENT_USER

if [[ $CURRENT_USER != "root" ]] && [[ $_CONTAINER_USER_HOME == "/root" ]]; then
_CONTAINER_USER_HOME="/home/$CURRENT_USER"
fi

git clone https://github.com/supercrabtree/k $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/k
git clone https://github.com/zsh-users/zsh-autosuggestions $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Expand Down

0 comments on commit 0c8fed4

Please sign in to comment.