build-container.sh 823 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -veu
  3. IMAGES="$(dirname "$0")"/../../../images
  4. OUT_ROOTFS_TAR="$IMAGES"/debian-9p-rootfs.tar
  5. OUT_ROOTFS_FLAT="$IMAGES"/debian-9p-rootfs-flat
  6. OUT_FSJSON="$IMAGES"/debian-base-fs.json
  7. CONTAINER_NAME=debian-full
  8. IMAGE_NAME=i386/debian-full
  9. mkdir -p "$IMAGES"
  10. docker build . --platform linux/386 --rm --tag "$IMAGE_NAME"
  11. docker rm "$CONTAINER_NAME" || true
  12. docker create --platform linux/386 -t -i --name "$CONTAINER_NAME" "$IMAGE_NAME" bash
  13. docker export "$CONTAINER_NAME" > "$OUT_ROOTFS_TAR"
  14. "$(dirname "$0")"/../../../tools/fs2json.py --out "$OUT_FSJSON" "$OUT_ROOTFS_TAR"
  15. # Note: Not deleting old files here
  16. mkdir -p "$OUT_ROOTFS_FLAT"
  17. "$(dirname "$0")"/../../../tools/copy-to-sha256.py "$OUT_ROOTFS_TAR" "$OUT_ROOTFS_FLAT"
  18. echo "$OUT_ROOTFS_TAR", "$OUT_ROOTFS_FLAT" and "$OUT_FSJSON" created.