Skip to content

Commit

Permalink
Improve Docker export in embedded-binaries Makefile
Browse files Browse the repository at this point in the history
Ensure that the binaries are moved into place, instead of sequentially
written. Use a temporary untar folder for that, and touch the file there
before moving it.

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Feb 7, 2024
1 parent 506d790 commit d68dc34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion embedded-bins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ $(bindir)/kubelet.exe $(bindir)/kube-proxy.exe: .container.kubernetes.windows
$(bindir)/containerd.exe $(bindir)/containerd-shim-runhcs-v1.exe: .container.containerd.windows

$(addprefix $(bindir)/, $(bins)): | $(bindir)
docker export $$(cat $<) | tar -C $(dir $(bindir)) -xv bin/$(notdir $@) && touch $@
tardir=$$(mktemp -d -- '$(notdir $@).XXXXXX.tmp') \
&& trap "rm -rf -- $$tardir" INT EXIT \
&& docker export "$$(cat $<)" \
| tar -C "$$tardir" -x bin/$(notdir $@) \
&& touch -c -- "$$tardir"/bin/$(notdir $@) \
&& mv "$$tardir"/bin/$(notdir $@) $@

build_docker_container = \
rm -f -- '$@'; \
Expand Down

0 comments on commit d68dc34

Please sign in to comment.