Update 'src/dkr_functions.bash'
This commit is contained in:
parent
6921d090dd
commit
51cf20f8f4
@ -16,10 +16,22 @@ function dkr::import_fs_as_layer() {
|
||||
# tar path = $1
|
||||
# base image = $2
|
||||
# final image = $3
|
||||
# whiteout file = $4
|
||||
|
||||
docker image import "$1" docker-isolate-flat-temp:latest > /dev/null
|
||||
echo "FROM docker-isolate-flat-temp:latest as isolated" > Dockerfile
|
||||
echo "FROM $2 as from_image" >> Dockerfile
|
||||
echo "COPY --from=isolated / /" >> Dockerfile
|
||||
|
||||
local WHITEOUT
|
||||
if [ -n "${4:-}" ]; then
|
||||
# Convert "./path/to/.wh.file" to "/path/to/file"
|
||||
WHITEOUT="$(awk '{gsub(/\.wh\./, "", $0); sub(/^\./, "", $0); printf "\"%s\" ", $0}' "$4")"
|
||||
if [ -n "$WHITEOUT" ]; then
|
||||
echo "RUN rm -f $WHITEOUT" >> Dockerfile
|
||||
fi
|
||||
fi
|
||||
|
||||
docker image build -f Dockerfile -t "$3" . > /dev/null
|
||||
docker image rm -f docker-isolate-flat-temp:latest > /dev/null
|
||||
rm -f Dockerfile
|
||||
|
Loading…
Reference in New Issue
Block a user