fix hero for git
This commit is contained in:
@@ -74,7 +74,7 @@ fn do() ! {
|
|||||||
|
|
||||||
// herocmds.cmd_bootstrap(mut cmd)
|
// herocmds.cmd_bootstrap(mut cmd)
|
||||||
// herocmds.cmd_run(mut cmd)
|
// herocmds.cmd_run(mut cmd)
|
||||||
// herocmds.cmd_git(mut cmd)
|
herocmds.cmd_git(mut cmd)
|
||||||
// herocmds.cmd_init(mut cmd)
|
// herocmds.cmd_init(mut cmd)
|
||||||
// herocmds.cmd_imagedownsize(mut cmd)
|
// herocmds.cmd_imagedownsize(mut cmd)
|
||||||
// herocmds.cmd_biztools(mut cmd)
|
// herocmds.cmd_biztools(mut cmd)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ COPY scripts/ourinit.sh /usr/local/bin/
|
|||||||
RUN chmod +x /tmp/install_v.sh /tmp/install_herolib.vsh
|
RUN chmod +x /tmp/install_v.sh /tmp/install_herolib.vsh
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
curl bash sudo mc wget tmux
|
curl bash sudo mc wget tmux htop
|
||||||
|
|
||||||
RUN bash /tmp/install_v.sh
|
RUN bash /tmp/install_v.sh
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ RUN bash /tmp/install_vscode.sh
|
|||||||
|
|
||||||
RUN /tmp/install_herolib.vsh && \
|
RUN /tmp/install_herolib.vsh && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
|
echo "PS1='HERO: \w \$ '" >> ~/.bashrc \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
|||||||
@@ -7,19 +7,6 @@ cd "$SCRIPT_DIR"
|
|||||||
# Remove any existing container named 'debug' (ignore errors)
|
# Remove any existing container named 'debug' (ignore errors)
|
||||||
docker rm -f herolib > /dev/null 2>&1
|
docker rm -f herolib > /dev/null 2>&1
|
||||||
|
|
||||||
# Run the Docker container
|
|
||||||
# docker run --name herolib -it \
|
|
||||||
# --entrypoint="/bin/bash" \
|
|
||||||
# -v "${SCRIPT_DIR}/scripts:/scripts" \
|
|
||||||
# -v "$HOME/code:/root/code" \
|
|
||||||
# -p 4100:8100 \
|
|
||||||
# -p 4101:8101 \
|
|
||||||
# -p 4102:8102 \
|
|
||||||
# -p 4379:6379 \
|
|
||||||
# -p 4000:3000 \
|
|
||||||
# herolib -c "/usr/local/bin/ourinit.sh && /bin/bash"
|
|
||||||
|
|
||||||
|
|
||||||
docker run --name herolib -it \
|
docker run --name herolib -it \
|
||||||
--entrypoint="/usr/local/bin/ourinit.sh" \
|
--entrypoint="/usr/local/bin/ourinit.sh" \
|
||||||
-v "${SCRIPT_DIR}/scripts:/scripts" \
|
-v "${SCRIPT_DIR}/scripts:/scripts" \
|
||||||
|
|||||||
61
docker/herolib/shell.sh
Executable file
61
docker/herolib/shell.sh
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Get the directory where the script is located
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
CONTAINER_NAME="herolib"
|
||||||
|
TARGET_PORT=4000
|
||||||
|
|
||||||
|
# Function to check if a container is running
|
||||||
|
is_container_running() {
|
||||||
|
docker ps --filter "name=$CONTAINER_NAME" --filter "status=running" -q
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if a port is accessible
|
||||||
|
is_port_accessible() {
|
||||||
|
nc -zv 127.0.0.1 "$1" &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if the container exists and is running
|
||||||
|
if ! is_container_running; then
|
||||||
|
echo "Container $CONTAINER_NAME is not running."
|
||||||
|
|
||||||
|
# Check if the container exists but is stopped
|
||||||
|
if docker ps -a --filter "name=$CONTAINER_NAME" -q | grep -q .; then
|
||||||
|
echo "Starting existing container $CONTAINER_NAME..."
|
||||||
|
docker start "$CONTAINER_NAME"
|
||||||
|
else
|
||||||
|
echo "Container $CONTAINER_NAME does not exist. Attempting to start with start.sh..."
|
||||||
|
if [[ -f "$SCRIPT_DIR/start.sh" ]]; then
|
||||||
|
bash "$SCRIPT_DIR/start.sh"
|
||||||
|
else
|
||||||
|
echo "Error: start.sh not found in $SCRIPT_DIR."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait for the container to be fully up
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify the container is running
|
||||||
|
if ! is_container_running; then
|
||||||
|
echo "Error: Failed to start container $CONTAINER_NAME."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Container $CONTAINER_NAME is running."
|
||||||
|
|
||||||
|
# Check if the target port is accessible
|
||||||
|
if is_port_accessible "$TARGET_PORT"; then
|
||||||
|
echo "Port $TARGET_PORT is accessible."
|
||||||
|
else
|
||||||
|
echo "Port $TARGET_PORT is not accessible. Please check the service inside the container."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enter the container
|
||||||
|
echo
|
||||||
|
echo " ** WE NOW LOGIN TO THE CONTAINER ** "
|
||||||
|
echo
|
||||||
|
docker exec -it herolib bash -c "PS1='HERO: \w \$ ' /bin/bash"
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Get the directory where the script is located
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,11 +48,12 @@ pub fn (mut gitstructure GitStructure) repos_print(args ReposGetArgs) ! {
|
|||||||
console.print_lf(1)
|
console.print_lf(1)
|
||||||
|
|
||||||
// Display header with optional argument filtering information
|
// Display header with optional argument filtering information
|
||||||
header := if args.str().len > 0 {
|
// header := if args.str().len > 0 {
|
||||||
'Repositories: ${gitstructure.config.coderoot} [${args.str()}]'
|
// 'Repositories: ${gitstructure.config.coderoot} [${args.str()}]'
|
||||||
} else {
|
// } else {
|
||||||
'Repositories: ${gitstructure.config.coderoot}'
|
// 'Repositories: ${gitstructure.config.coderoot}'
|
||||||
}
|
// }
|
||||||
|
header:='Repositories: ${gitstructure.config.coderoot}'
|
||||||
console.print_header(header)
|
console.print_header(header)
|
||||||
|
|
||||||
// Print the repository information in a formatted array
|
// Print the repository information in a formatted array
|
||||||
|
|||||||
Reference in New Issue
Block a user