Skip to content

Commit a68658e

Browse files
authored
Merge pull request #151 from halfdoctor/fix/update-build-scripts
Merge halfdoctor:fix/update-build-scripts to base:dockerify
2 parents b61f1c3 + 7248262 commit a68658e

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
branches: [ "main", "dockerify", "experimental"]
1313
# Publish semver tags as releases.
1414
tags: [ 'v*.*.*' ]
15+
pull_request:
16+
branches: [ "main" ]
1517

1618
env:
1719
# Use docker.io for Docker Hub if empty

build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,25 @@ echo "🏗️ Building setup container..."
2020
docker build -f Dockerfile.setup -t snapshotter-lite-setup:latest .
2121

2222
# Create a temporary file to capture the env file path from setup
23-
SETUP_RESULT_FILE=$(mktemp)
23+
SETUP_RESULT_DIR=$(mktemp -d "$(pwd)/setup_result.XXXXXX")
24+
SETUP_RESULT_FILE="$SETUP_RESULT_DIR/setup_result"
2425

2526
# Run setup container directly
2627
echo "🔧 Running setup container to configure environment..."
2728
docker run --rm -it \
2829
-v "$(pwd):/app" \
29-
-v "$SETUP_RESULT_FILE:/tmp/setup_result" \
30+
-v "$SETUP_RESULT_DIR:/tmp/setup_result_dir" \
3031
-w /app \
3132
snapshotter-lite-setup:latest \
32-
bash -c "./configure-environment.sh $SETUP_ARGS --docker-mode"
33+
bash -c "./configure-environment.sh $SETUP_ARGS --docker-mode --result-file /tmp/setup_result_dir/setup_result"
3334

3435
# Remove the setup container image
3536
docker rmi snapshotter-lite-setup:latest
3637

3738
# Check if setup was successful by reading the result file
3839
if [ -f "$SETUP_RESULT_FILE" ] && [ -s "$SETUP_RESULT_FILE" ]; then
3940
SELECTED_ENV_FILE=$(cat "$SETUP_RESULT_FILE")
40-
rm -f "$SETUP_RESULT_FILE"
41+
rm -rf "$SETUP_RESULT_DIR"
4142

4243
if [ -n "$SELECTED_ENV_FILE" ] && [ -f "$SELECTED_ENV_FILE" ]; then
4344
echo "ℹ️ Setup container configured: $SELECTED_ENV_FILE"
@@ -49,7 +50,7 @@ if [ -f "$SETUP_RESULT_FILE" ] && [ -s "$SETUP_RESULT_FILE" ]; then
4950
fi
5051
else
5152
echo "❌ Setup container did not complete successfully or failed to report results."
52-
rm -f "$SETUP_RESULT_FILE"
53+
rm -rf "$SETUP_RESULT_DIR"
5354
exit 1
5455
fi
5556

configure-environment.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NO_COLLECTOR=false
99
OVERRIDE_DEFAULTS_SCRIPT_FLAG=false
1010
DEVNET_MODE=false
1111
DOCKER_MODE=false
12+
RESULT_FILE=""
1213

1314
# GitHub configuration URL
1415
MARKETS_CONFIG_URL="https://raw.githubusercontent.com/powerloom/curated-datamarkets/main/sources.json"
@@ -425,6 +426,10 @@ parse_arguments() {
425426
DOCKER_MODE=true
426427
shift
427428
;;
429+
--result-file)
430+
RESULT_FILE=$2
431+
shift 2
432+
;;
428433
*)
429434
shift
430435
;;
@@ -862,6 +867,7 @@ set_default_optional_variables() {
862867
"STREAM_WRITE_TIMEOUT_MS:5000"
863868
"MAX_WRITE_RETRIES:3"
864869
"MAX_CONCURRENT_WRITES:4"
870+
"TELEGRAM_MESSAGE_THREAD_ID:"
865871
)
866872

867873
for var_def in "${optional_vars[@]}"; do
@@ -956,9 +962,9 @@ main() {
956962
if [ "$SETUP_COMPLETE" = true ]; then
957963
echo "✅ Configuration complete. Environment file ready at $ENV_FILE_PATH"
958964

959-
# Write the env file path to the result file for the build script (if result file exists)
960-
if [ -n "$ENV_FILE_PATH" ] && [ -w "/tmp/setup_result" ] 2>/dev/null; then
961-
echo "$ENV_FILE_PATH" > /tmp/setup_result
965+
# Write the env file path to the result file for the build script
966+
if [ -n "$RESULT_FILE" ]; then
967+
echo "$ENV_FILE_PATH" > "$RESULT_FILE"
962968
echo "🔗 Reported env file to build script: $ENV_FILE_PATH"
963969
fi
964970
else

0 commit comments

Comments
 (0)