Merge pull request #1 from cloud-neutral-toolkit/fix-cloud-run-build-and-startup-3517540955516058013

Fix Cloud Run build failure and stunnel startup issues
This commit is contained in:
cloudneutral 2026-01-21 15:59:28 +08:00 committed by GitHub
commit e4ff53dfb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# ------------------------------
# Stage 1 — Build
# ------------------------------
FROM golang:1.25 AS builder
FROM golang:1.24 AS builder
WORKDIR /src
@ -23,7 +23,7 @@ FROM ubuntu:24.04
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates stunnel4 gettext-base \
&& apt-get install -y --no-install-recommends ca-certificates stunnel4 gettext-base netcat-openbsd \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /var/run/stunnel \
&& chown -R nobody:nogroup /var/run/stunnel

View File

@ -50,14 +50,27 @@ EOF
stunnel "${STUNNEL_CONF}"
# Wait for stunnel to be up (simple check)
for i in {1..10}; do
STUNNEL_UP=0
for i in {1..30}; do
if nc -z 127.0.0.1 5432; then
echo "Stunnel is up!"
STUNNEL_UP=1
break
fi
echo "Waiting for Stunnel..."
echo "Waiting for Stunnel... ($i/30)"
sleep 1
done
if [ "${STUNNEL_UP}" -eq 0 ]; then
echo "Error: Stunnel failed to start or is not reachable on port 5432."
echo "Stunnel logs:"
if [ -f "/var/log/stunnel.log" ]; then
cat /var/log/stunnel.log
else
echo "No stunnel log found."
fi
exit 1
fi
fi
# -----------------------------------------------------------------------------

2
go.mod
View File

@ -1,6 +1,6 @@
module account
go 1.25.1
go 1.24.0
require (
github.com/gin-contrib/cors v1.7.6