Hacker News new | ask | show | jobs
by crabique 870 days ago
At this point, why not just build statically linked binaries of those utils in the build stage and just copy them over? Or even better, have a static build of busybox with all of the non-dependencies disabled. Those filename bytes add up fast!

On unrelated note, --chmod parameter of the COPY instruction provides a way to avoid additional layers just to set the executable bits:

  # instead of
  COPY ugit .
  RUN chmod +x ugit && mv ugit /usr/local/bin/
  COPY --from=builder /usr/local/bin/ugit /usr/bin/

  # could just be this
  COPY ugit --chmod=755 /usr/bin/
In all seriousness though, that Dockerfile is basically one big uglified red flag, please don't do this, people.