Mnovich/temporal foreground tasks (#2895)
Co-authored-by: Carlos M. Lopez <carlopez@squareup.com>
This commit is contained in:
+34
-16
@@ -14,22 +14,40 @@ if [ ! -f "go.sum" ]; then
|
||||
go mod tidy
|
||||
fi
|
||||
|
||||
# Build the service
|
||||
echo "Compiling Go binary..."
|
||||
go build -o temporal-service main.go
|
||||
# Determine binary name based on target OS
|
||||
BINARY_NAME="temporal-service"
|
||||
if [ "${GOOS:-}" = "windows" ]; then
|
||||
BINARY_NAME="temporal-service.exe"
|
||||
fi
|
||||
|
||||
# Make it executable
|
||||
chmod +x temporal-service
|
||||
# Build the service with cross-compilation support
|
||||
echo "Compiling Go binary..."
|
||||
if [ -n "${GOOS:-}" ] && [ -n "${GOARCH:-}" ]; then
|
||||
echo "Cross-compiling for ${GOOS}/${GOARCH}..."
|
||||
GOOS="${GOOS}" GOARCH="${GOARCH}" go build -o "${BINARY_NAME}" .
|
||||
else
|
||||
echo "Building for current platform..."
|
||||
go build -o "${BINARY_NAME}" .
|
||||
fi
|
||||
|
||||
# Make it executable (skip on Windows as it's not needed)
|
||||
if [ "${GOOS:-}" != "windows" ]; then
|
||||
chmod +x "${BINARY_NAME}"
|
||||
fi
|
||||
|
||||
echo "Build completed successfully!"
|
||||
echo "Binary location: $(pwd)/temporal-service"
|
||||
echo ""
|
||||
echo "Prerequisites:"
|
||||
echo " 1. Install Temporal CLI: brew install temporal"
|
||||
echo " 2. Start Temporal server: temporal server start-dev"
|
||||
echo ""
|
||||
echo "To run the service:"
|
||||
echo " ./temporal-service"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " PORT - HTTP port (default: 8080)"
|
||||
echo "Binary location: $(pwd)/${BINARY_NAME}"
|
||||
|
||||
# Only show usage info if not cross-compiling
|
||||
if [ -z "${GOOS:-}" ] || [ "${GOOS}" = "$(go env GOOS)" ]; then
|
||||
echo ""
|
||||
echo "Prerequisites:"
|
||||
echo " 1. Install Temporal CLI: brew install temporal"
|
||||
echo " 2. Start Temporal server: temporal server start-dev"
|
||||
echo ""
|
||||
echo "To run the service:"
|
||||
echo " ./${BINARY_NAME}"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " PORT - HTTP port (default: 8080)"
|
||||
fi
|
||||
Reference in New Issue
Block a user