#!/bin/bash # Fix Go Dockerfiles to work with our minimal source structure WORKSPACE="/home/localuser/TSYSDevStack/Cloudron/CloudronPackages-Workspace" GO_APPS=( "goalert" "webhook" "chirpstack" "database-gateway" "easy-gate" "fleet" "gophish" "mendersoftware" "signoz" "tirreno" ) echo "🔧 Fixing Go Dockerfiles..." for app in "${GO_APPS[@]}"; do dockerfile="$WORKSPACE/$app/app/Dockerfile" if [ -f "$dockerfile" ]; then echo " 📝 Fixing $app..." # Update the COPY line to not require go.sum sed -i 's/COPY go.mod go.sum \./COPY go.mod \./g' "$dockerfile" # Update the build command to work with our structure sed -i 's/RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main \.\/cmd\/\.\.\./RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .\/cmd\/main/g' "$dockerfile" # Update the COPY path for the binary sed -i 's/COPY --from=builder \/build\/main \/app\/main/COPY --from=builder \/build\/cmd\/main\/main \/app\/main/g' "$dockerfile" fi done echo "✅ Go Dockerfiles fixed!"