Build binaries with minimal deps and remove autogen code#40180
Build binaries with minimal deps and remove autogen code#40180tonistiigi merged 5 commits intomoby:masterfrom
Conversation
f7af678 to
8f477f2
Compare
Dockerfile
Outdated
There was a problem hiding this comment.
Perhaps instead of copying these to /usr/local/bin we could just add the bundles directory to PATH, similar to what I did in docker/cli#419 (not sure if there's code that expects the binaries to be in /usr/local/bin though)
There was a problem hiding this comment.
Here is the logic:
Lines 4 to 31 in c36460c
So we can add them anywhere into PATH, or add anywhere to PATH, or just copy them manually.
I wanted to reduce redundant code as much as possible here.
The other thing that makes it kinda tricky is each build target builds in a subdir, like bundles/binary-daemon and bundles/dynbinary-daemon, so I'd have to do this copy twice.
I could bind-mount the files in and update PATH to include each one, but this would only reduce the amount of copying we are doing.
There was a problem hiding this comment.
Basically my worry here is we have this list of commands that need to be copied as part of a build and different lists get out of sync.
8f477f2 to
1499b27
Compare
|
Ping |
thaJeztah
left a comment
There was a problem hiding this comment.
whoops, forgot about this one; left some comments 🤗
This makes the binary build targets use a minimal build env instead of having to build all the stuff needed for the full dev enviornment. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
1499b27 to
f2d171a
Compare
This eliminates the need to lay down an auto-generated file. IIRC this was originally hadded for gccgo which we no longer support. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
The Dockerfile is not needed in any of the build targets. The one exception may be the dev image, however in most cases the docker source will be bind mounted into the container anyway. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
f2d171a to
e6d514d
Compare
|
Fixed. |
Dockerfile
Outdated
|
|
||
| FROM dev AS src | ||
| FROM runtime-dev AS src | ||
| # Make arg inheritable |
|
|
||
| FROM src AS final | ||
| FROM dev AS final | ||
| COPY . /go/src/github.com/docker/docker |
There was a problem hiding this comment.
nit (no need to change); /go/src/github.com/docker/docker is the WORKDIR, is this could be
COPY . .|
|
||
| // Code generated by hack/make/.go-autogen. DO NOT EDIT. | ||
| DVEOF | ||
| LDFLAGS="${LDFALGS} \ |
Upstream moby/moby#40180 removed the auto-generated code, replacing it with build-time variables (-X). This patch updates the Dockerfiles to account for this change. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This was removed after refactoring the Dockerfile in moby#40180 Signed-off-by: Brian Goff <cpuguy83@gmail.com>
More optimizations for the Dockerfile
i. Prevents rebuilding things just because there is some change in either of these files.
ii. Is not needed since we don't do nested build.