This commit is contained in:
jay
2025-05-15 11:22:56 +08:00
parent 89fb2a1b56
commit 28d7111aee
4 changed files with 132 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -xe
# usage: pack-magneto2-source <image repo> [output folder]
if [ $# -lt 1 ]; then
echo "Usage: $0 <image repo> [output folder]"
exit 1
fi
IMAGE_REPO=$1
OUTPUT_FOLDER=$(realpath "${2:-.}")
# echo "Packing Magento 2 source code from $IMAGE_REPO to $OUTPUT_FOLDER"
uid=$(id -u)
docker run -it --rm -v "$OUTPUT_FOLDER:/out" -e "HOST_UID=$uid" \
"$IMAGE_REPO" \
bash -c 'cd /app && \
find /app -type f -iname "*test*" -exec rm -f {} \; && \
rm -rf /app/node_modules && \
rm -rf /app/system/modules/swagger/public/swagger-ui/* && \
chown -R $HOST_UID /app && \
tar -cvf /out/magneto2.tar . && \
chown $HOST_UID /out/magneto2.tar'
# vim : set ft=sh :