Skip to content

Commit 7f2e8d2

Browse files
committed
Fix(aws): Make sure docker wrapper script runs fully even when we exit
Closes #70
1 parent 5f0f89b commit 7f2e8d2

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

aws/docker_and_sync.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ cleanup() {
2828
docker system prune -af
2929
echo "Docker space usage:"
3030
docker system df
31+
echo "═══════════════════════════════════════════════════════════════════════════════"
32+
echo "✅ Wrapper script docker_and_sync.sh finished, exit code: $exit_code"
33+
echo "═══════════════════════════════════════════════════════════════════════════════"
3134
exit $exit_code
3235
}
3336

@@ -82,9 +85,8 @@ mkdir -p logs
8285
# Set ulimit for number of open files, relevant for matrix
8386
ulimit -n 65536
8487

85-
# Execute the command passed to container
86-
"$@"
87-
8888
echo "═══════════════════════════════════════════════════════════════════════════════"
89-
echo "✅ Wrapper script docker_and_sync.sh finished"
89+
echo "✅ Wrapper script docker_and_sync.sh pologue finished, executing user command: $*"
9090
echo "═══════════════════════════════════════════════════════════════════════════════"
91+
# Execute the command passed to container
92+
"$@"

aws/setup/docker/docker_entrypoint.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ echo "════════════════════════
66
echo "🚀 Hello from docker_entrypoint.sh"
77
echo "═══════════════════════════════════════════════════════════════════════════════"
88

9+
# Function to show disk usage on exit
10+
cleanup() {
11+
local exit_code=$?
12+
echo "💾 Disk usage after job:"
13+
df -h
14+
echo "═══════════════════════════════════════════════════════════════════════════════"
15+
echo "✅ docker_entrypoint.sh finished, exit code: $exit_code"
16+
echo "═══════════════════════════════════════════════════════════════════════════════"
17+
exit $exit_code
18+
}
19+
20+
# Set trap to always show disk usage on exit (normal exit, signals, errors)
21+
trap cleanup EXIT
22+
923
echo "📅 Container built at: $BUILD_TIMESTAMP"
1024
echo "🔄 Updating repository..."
1125

@@ -42,13 +56,3 @@ echo "$@"
4256
echo "═══════════════════════════════════════════════════════════════════════════════"
4357
# Execute the remaining command arguments
4458
exec "$@"
45-
echo "═══════════════════════════════════════════════════════════════════════════════"
46-
echo "✅ User provided command finished"
47-
echo "═══════════════════════════════════════════════════════════════════════════════"
48-
49-
echo "💾 Disk usage after job:"
50-
df -h
51-
52-
echo "═══════════════════════════════════════════════════════════════════════════════"
53-
echo "✅ docker_entrypoint.sh finished"
54-
echo "═══════════════════════════════════════════════════════════════════════════════"

0 commit comments

Comments
 (0)