squash: fix extraction order not being preserved
squash: fix extraction order not being preserved

The previous approach to squashing would simply go through the layers
from the app layer to the base layer and add the files to the final ACI
image file.

This produced incorrect ACIs because it doesn't preserve the extraction
order. When a file was overwriting a directory present in a previous
layer, the squashed ACI had the directory entry *after* the file.

We now create a map of files to ACI layers and populate it starting from
the base image. If files are repeated we take the last one. Then, we do
a second pass and add the file entry to the output tarball if the
current layer is the correct one.

vishvananda/docker2aci,ChengTiesheng/docker2aci,jsoriano/docker2aci,sgotti/docker2aci,appc/docker2aci,OMWAVE/docker2aci,jonboulle/docker2aci,pquerna/docker2aci,OMWAVE/docker2aci,mclarkson/docker2aci,jumpstarter-io/docker2aci,dgonyeo/docker2aci,vishvananda/docker2aci,appc/docker2aci,dgonyeo/docker2aci,endocode/docker2aci,iaguis/docker2aci,jsoriano/docker2aci