Skip to content

Commit

Permalink
Changed docker builds from localhost for 127.0.0.1 so it matches Dock…
Browse files Browse the repository at this point in the history
…er's insecure registry defaults without requiring https
  • Loading branch information
jaydrogers committed Dec 18, 2024
1 parent baebfbc commit 41a5126
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/actions/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ action_deploy() {
# Set default values (can be overridden by .env file or command line arguments)
registry_port="${SPIN_REGISTRY_PORT:-5080}"
build_platform="${SPIN_BUILD_PLATFORM:-"linux/amd64"}"
image_prefix="${SPIN_BUILD_IMAGE_PREFIX:-"localhost:$registry_port"}"
image_prefix="${SPIN_BUILD_IMAGE_PREFIX:-"127.0.0.1:$registry_port"}"
image_tag="${SPIN_BUILD_TAG:-$(date +%Y%m%d%H%M%S)}"
ssh_port="${SPIN_SSH_PORT:-22}"
ssh_user="${SPIN_SSH_USER:-"deploy"}"
Expand Down Expand Up @@ -286,7 +286,7 @@ action_deploy() {
# Build SSH command with proper quoting
ssh_cmd=(
ssh -f -n -N
-R "${registry_port}:localhost:${registry_port}"
-R "${registry_port}:127.0.0.1:${registry_port}"
-p "${ssh_port}"
"${ssh_user}@${docker_swarm_manager}"
-o ExitOnForwardFailure=yes
Expand All @@ -303,7 +303,7 @@ action_deploy() {
echo " 🔌 Remote port: ${registry_port}"
echo " 👤 SSH user: ${ssh_user}"
echo " 🔢 SSH port: ${ssh_port}"
echo "${BOLD}${BLUE}🔄 The tunnel will forward connections from the remote port ${registry_port} to localhost:${registry_port}${RESET}"
echo "${BOLD}${BLUE}🔄 The tunnel will forward connections from the remote port ${registry_port} to 127.0.0.1:${registry_port}${RESET}"
else
ssh_exit_code=$?
echo "${BOLD}${RED}❌ Failed to create SSH tunnel (Exit code: $ssh_exit_code)${RESET}"
Expand All @@ -313,7 +313,7 @@ action_deploy() {
fi

# Get the process ID of the SSH tunnel using POSIX-compliant commands
tunnel_pid=$(ps aux | grep "ssh -f -n -N -R ${registry_port}:localhost:${registry_port}" | grep -v grep | awk '{print $2}')
tunnel_pid=$(ps aux | grep "ssh -f -n -N -R ${registry_port}:127.0.0.1:${registry_port}" | grep -v grep | awk '{print $2}')

echo "${BOLD}${BLUE}🚀 Deploying Docker stack...${RESET}"
deploy_docker_stack "$docker_swarm_manager" "$ssh_port"
Expand Down

0 comments on commit 41a5126

Please sign in to comment.