Skip to content

Commit

Permalink
Enhancement (ci): Rename build state artifact to .build.state (star…
Browse files Browse the repository at this point in the history
…tersclan#117)

The build state file being an artifact is better named as a hidden file. That way, the file can more easily be ignored in dev environments with `.gitignore` and run less risk of being accidentally committed.
  • Loading branch information
joeltimothyoh authored Mar 7, 2023
1 parent dab98f4 commit c5ef327
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ if [ ! "$NO_PUSH" = 'true' ]; then
docker logout
fi

# Create build.state artifact
echo "Creating build.state artifact"
# Create .build.state artifact
echo "Creating .build.state artifact"
# Searching for 'WORKDIR /server' is a reliable way to locate the base image layers
BASE_SIZE=0; for i in $( docker history "$REPOSITORY:latest" --format='{{.Size}} {{.CreatedAt}} {{.CreatedBy}}' --no-trunc --human=false | grep 'WORKDIR /server' -A99999 | awk '{print $1}' ); do BASE_SIZE=$(( $BASE_SIZE + $i )); done
# Searching for 'UPDATE' is a reliable way to determine the incremental image layers
LAYERS_SIZE=0; for i in $( docker history "$REPOSITORY:latest" --format='{{.Size}} {{.CreatedAt}} {{.CreatedBy}}' --no-trunc --human=false | grep UPDATE | awk '{print $1}' ); do LAYERS_SIZE=$(( $LAYERS_SIZE + $i )); done
LAYERED_SIZE=$(( $BASE_SIZE + $LAYERS_SIZE ))
cat - > build.state <<EOF
cat - > .build.state <<EOF
BASE_SIZE=$BASE_SIZE
LAYERED_SIZE=$LAYERED_SIZE
DIFF=$LAYERS_SIZE
EOF
cat build.state
ls -al build.state
cat .build.state
ls -al .build.state

0 comments on commit c5ef327

Please sign in to comment.