From e94548fb999491a39507d8858900207d1d27e7ee Mon Sep 17 00:00:00 2001 From: Ryota Funaki Date: Wed, 11 Sep 2024 10:52:52 +0900 Subject: [PATCH] Shell structure improved (#10) --- Dockerfile | 6 +++--- {root_shells => shells/root}/install.sh | 6 +----- {root_shells => shells/root}/shells.d/install_composer.sh | 0 {root_shells => shells/root}/shells.d/install_dotnet.sh | 0 {user_shells => shells/user}/install.sh | 2 +- {user_shells => shells/user}/shells.d/install_kiota.sh | 0 6 files changed, 5 insertions(+), 9 deletions(-) rename {root_shells => shells/root}/install.sh (75%) rename {root_shells => shells/root}/shells.d/install_composer.sh (100%) rename {root_shells => shells/root}/shells.d/install_dotnet.sh (100%) rename {user_shells => shells/user}/install.sh (91%) rename {user_shells => shells/user}/shells.d/install_kiota.sh (100%) diff --git a/Dockerfile b/Dockerfile index 4b33f15..744c103 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM php:latest # Install dependencies RUN apt update && \ - apt install -y sudo gnupg2 wget git + apt install -y sudo git gnupg2 vim curl lsb-release wget # Create a non-root user ARG USER_NAME=developer @@ -12,7 +12,7 @@ RUN useradd -m ${USER_NAME} -s /bin/bash RUN echo "$USER_NAME ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME} # Install development tools for root -COPY ./root_shells/ ./shells/ +COPY ./shells/root/ ./shells/ RUN cd ./shells && \ chmod +x install.sh && \ ./install.sh && \ @@ -24,7 +24,7 @@ USER ${USER_NAME} WORKDIR /home/${USER_NAME} # Install development tools for non-root -COPY --chown=${USER_NAME}:${USER_NAME} ./user_shells/ ./shells/ +COPY --chown=${USER_NAME}:${USER_NAME} ./shells/user/ ./shells/ RUN cd ./shells && \ chmod +x install.sh && \ ./install.sh && \ diff --git a/root_shells/install.sh b/shells/root/install.sh similarity index 75% rename from root_shells/install.sh rename to shells/root/install.sh index 1779308..075214f 100644 --- a/root_shells/install.sh +++ b/shells/root/install.sh @@ -3,7 +3,7 @@ # This source code is managed under the MIT license. See LICENSE in the project root. # Execute all scripts in the shells.d directory -TARGET_FILES=$(find shells.d -type f -name "*.sh" | sort) +TARGET_FILES=$(find ./shells.d -type f -name "*.sh" | sort) for file in $TARGET_FILES; do bash "$file" if [ $? -ne 0 ]; then @@ -11,8 +11,4 @@ for file in $TARGET_FILES; do exit 1 fi done - -# Clean up -apt clean -rm -rf /var/lib/apt/lists/* exit 0 diff --git a/root_shells/shells.d/install_composer.sh b/shells/root/shells.d/install_composer.sh similarity index 100% rename from root_shells/shells.d/install_composer.sh rename to shells/root/shells.d/install_composer.sh diff --git a/root_shells/shells.d/install_dotnet.sh b/shells/root/shells.d/install_dotnet.sh similarity index 100% rename from root_shells/shells.d/install_dotnet.sh rename to shells/root/shells.d/install_dotnet.sh diff --git a/user_shells/install.sh b/shells/user/install.sh similarity index 91% rename from user_shells/install.sh rename to shells/user/install.sh index 452b6fe..36f28e9 100644 --- a/user_shells/install.sh +++ b/shells/user/install.sh @@ -3,7 +3,7 @@ # This source code is managed under the MIT license. See LICENSE in the project root. # Execute all scripts in the shells.d directory -TARGET_FILES=$(find shells.d -type f -name "*.sh" | sort) +TARGET_FILES=$(find ./shells.d -type f -name "*.sh" | sort) for file in $TARGET_FILES; do bash "$file" if [ $? -ne 0 ]; then diff --git a/user_shells/shells.d/install_kiota.sh b/shells/user/shells.d/install_kiota.sh similarity index 100% rename from user_shells/shells.d/install_kiota.sh rename to shells/user/shells.d/install_kiota.sh