Skip to content

Commit

Permalink
Shell structure improved (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryotafunaki authored Sep 11, 2024
1 parent 930f015 commit e94548f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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
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 && \
Expand All @@ -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 && \
Expand Down
6 changes: 1 addition & 5 deletions root_shells/install.sh → shells/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
# 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
echo "Failed to execute $file"
exit 1
fi
done

# Clean up
apt clean
rm -rf /var/lib/apt/lists/*
exit 0
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion user_shells/install.sh → shells/user/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit e94548f

Please sign in to comment.