Last active
June 27, 2018 07:58
-
-
Save chimame/b103f783b3e8823fe14a03242b37b9d8 to your computer and use it in GitHub Desktop.
Dockerコンテナ内のassets系をキャッシュするために出力する処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IFS=$',' | |
CACHE_DIRS="public/assets,tmp/cache" | |
WORK_DIR_IN_DOCKER="/app" | |
i=1 | |
docker run -it -d --entrypoint /bin/sh --name run_cache_container <image name> -c /bin/sh | |
for VAL in ${CACHE_DIRS} | |
do | |
docker exec run_cache_container tar czf assets_cache_${i}.tar.gz -C $WORK_DIR_IN_DOCKER $VAL | |
docker cp run_cache_container:${WORK_DIR_IN_DOCKER}/assets_cache_${i}.tar.gz assets_cache_${i}.tar.gz | |
let i++ | |
done | |
docker rm run_cache_container -f | |
IFS=$' \t\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment