Skip to content

Commit

Permalink
use export import combination to build squashed image
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed Mar 31, 2024
1 parent df53090 commit e18717d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ jobs:
DB_CONTAINER_ID="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .ID')"
DB_IMAGE="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .Image')"
docker container commit "$DB_CONTAINER_ID" "$DB_IMAGE"
# docker container commit "$DB_CONTAINER_ID" "$DB_IMAGE"
# docker image ls "$DB_IMAGE"
docker export "$DB_CONTAINER_ID" | docker import - "$DB_IMAGE"
docker image ls "$DB_IMAGE"
# Squash image to reduce size by removing duplicated added/removed files in Docker layers
# Docker container commit does not support squashing, see https://github.com/docker/for-linux/issues/453#issuecomment-668645475
echo "FROM $DB_IMAGE" > Dockerfile
docker build --squash -t squashed .
docker tag squashed "$DB_IMAGE"
# echo "FROM $DB_IMAGE" > Dockerfile
# docker build --squash -t squashed .
# docker tag squashed "$DB_IMAGE"
docker image ls "$DB_IMAGE"
docker push "$DB_IMAGE"
# generate-tiles:
Expand Down

0 comments on commit e18717d

Please sign in to comment.