Skip to content

Commit

Permalink
docker fx
Browse files Browse the repository at this point in the history
  • Loading branch information
azep-ninja committed Jan 10, 2025
1 parent 640ce58 commit efc5c98
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 49 deletions.
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ CMD sh -c 'echo "Debug: Starting container initialization" && \
used_space=$(df -B1 --output=used /app/agent/data | tail -1) && \
avail_space=$(df -B1 --output=avail /app/agent/data | tail -1) && \
format_size() { \
local bytes=$1; \
if [ $bytes -lt 1000 ]; then \
local bytes="$1"; \
if [ "$bytes" -lt 1000 ]; then \
echo "${bytes} B"; \
elif [ $bytes -lt 1000000 ]; then \
echo "$(( (bytes + 500) / 1000 )) KB"; \
elif [ $bytes -lt 1000000000 ]; then \
echo "$(( (bytes + 500000) / 1000000 )) MB"; \
elif [ "$bytes" -lt 1000000 ]; then \
echo "$((($bytes + 500) / 1000)) KB"; \
elif [ "$bytes" -lt 1000000000 ]; then \
echo "$((($bytes + 500000) / 1000000)) MB"; \
else \
echo "$(( (bytes + 500000000) / 1000000000 )) GB"; \
echo "$((($bytes + 500000000) / 1000000000)) GB"; \
fi; \
} && \
echo "{\
Expand All @@ -252,10 +252,10 @@ CMD sh -c 'echo "Debug: Starting container initialization" && \
\"availableSpace\": $avail_space\
},\
\"readable\": {\
\"dbSize\": \"$(format_size $db_size)\",\
\"totalSpace\": \"$(format_size $total_space)\",\
\"usedSpace\": \"$(format_size $used_space)\",\
\"availableSpace\": \"$(format_size $avail_space)\"\
\"dbSize\": \"$(format_size "$db_size")\",\
\"totalSpace\": \"$(format_size "$total_space")\",\
\"usedSpace\": \"$(format_size "$used_space")\",\
\"availableSpace\": \"$(format_size "$avail_space")\"\
},\
\"timestamp\": \"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"\
}" > /tmp/storage-info.json && \
Expand Down
Loading

0 comments on commit efc5c98

Please sign in to comment.