1
0

build.sh 918 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. cd "$(dirname "$0")"
  4. IMAGES=../../../images
  5. OUT_ROOTFS_TAR="$IMAGES"/alpine-rootfs.tar
  6. OUT_ROOTFS_FLAT="$IMAGES"/alpine-rootfs-flat
  7. OUT_FSJSON="$IMAGES"/alpine-fs.json
  8. CONTAINER_NAME=alpine-v86
  9. IMAGE_NAME=i386/alpine-v86
  10. mkdir -p "$IMAGES"
  11. docker build . --platform linux/386 --rm --tag "$IMAGE_NAME"
  12. docker rm "$CONTAINER_NAME" || true
  13. docker create --platform linux/386 -t -i --name "$CONTAINER_NAME" "$IMAGE_NAME"
  14. docker export "$CONTAINER_NAME" -o "$OUT_ROOTFS_TAR"
  15. # https://github.com/iximiuz/docker-to-linux/issues/19#issuecomment-1242809707
  16. tar -f "$OUT_ROOTFS_TAR" --delete ".dockerenv" || true
  17. ../../../tools/fs2json.py --out "$OUT_FSJSON" "$OUT_ROOTFS_TAR"
  18. # Note: Not deleting old files here
  19. mkdir -p "$OUT_ROOTFS_FLAT"
  20. ../../../tools/copy-to-sha256.py "$OUT_ROOTFS_TAR" "$OUT_ROOTFS_FLAT"
  21. echo "$OUT_ROOTFS_TAR", "$OUT_ROOTFS_FLAT" and "$OUT_FSJSON" created.