docker-client icon indicating copy to clipboard operation
docker-client copied to clipboard

Add Hardlink Support

Open hohle opened this issue 6 years ago • 3 comments

Adds support for identifying hardlinks when building a CompressedDirectory to match the functionality of docker-go.

I have a use case where there are several hundred MBs of hard linked files that are added to a docker image. The official CLI identifies the files which share the same inode and sends the build context appropriately resulting in a layer where links to the same file match what was in the context.

While integrating dockerfile-maven I found the hard links were not being respected resulting in layers which were significantly larger that those created with the CLI.

I've added a new unit test for the use case as well as confirmed locally through the maven plugin.

hohle avatar May 13 '19 20:05 hohle

I'll need to refactor the unit test to account for the differences in the order of directory entries on different file systems. In the mean time, feel free to leave any feedback while I update the PR.

hohle avatar May 14 '19 15:05 hohle

Codecov Report

Merging #1157 into master will increase coverage by 0.12%. The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #1157      +/-   ##
============================================
+ Coverage     68.17%   68.29%   +0.12%     
  Complexity      800      800              
============================================
  Files           181      181              
  Lines          3918     3927       +9     
  Branches        410      412       +2     
============================================
+ Hits           2671     2682      +11     
+ Misses         1077     1076       -1     
+ Partials        170      169       -1

codecov[bot] avatar May 14 '19 17:05 codecov[bot]

@hohle I needed to fix hardlink support and noticed you did already. So I've forked the docker-client and dockerfile-maven over here and integrated your change for hardlinks. They have both been released to Maven Central using the ca.vanzyl groupId instead of com.spotify.

https://repo.maven.apache.org/maven2/ca/vanzyl/docker-client/8.16.1/

and

https://repo.maven.apache.org/maven2/ca/vanzyl/dockerfile-maven-plugin/1.4.14/

jvanzyl avatar Feb 09 '20 13:02 jvanzyl