Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.11] Dockerfile: install musl-dev to fix build on alpine 3.18 and up #4579

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

thaJeztah
Copy link
Member

Before this:

docker build --build-arg ALPINE_VERSION=3.18 --build-arg GO_VERSION=1.20.13 --target integration-tests .
 > [dnsname 3/3] RUN --mount=target=/root/.cache,type=cache   set -e; make binaries; mv bin/dnsname /usr/bin/dnsname:
0.435 GO111MODULE=on go build -mod=vendor -ldflags '-X main.gitCommit=18822f9a4fb35d1349eb256f4cd2bfd372474d84' -o bin/dnsname github.com/containers/dnsname/plugins/meta/dnsname
0.610 # runtime/cgo
0.610 In file included from _cgo_export.c:3:
0.610 /usr/include/fortify/stdlib.h:23:15: fatal error: stdlib.h: No such file or directory
0.610    23 | #include_next <stdlib.h>
0.610       |               ^~~~~~~~~~
0.610 compilation terminated.

With this patch:

docker build --build-arg ALPINE_VERSION=3.18 --build-arg GO_VERSION=1.20.13 --target integration-tests .
...
 => exporting to image                                                                                                                             0.0s
 => => exporting layers                                                                                                                            0.0s
 => => exporting manifest sha256:59323c8f3ae7d6510ad7d89304e1315d73d5171dbbaca1bb76fbabcd8c100d28                                                  0.0s
 => => exporting config sha256:3c98c4ca486e2e0c4dd4d7625c70d10bd15d0df8e7385a99f7ccd83d5f65c93f                                                    0.0s
 => => exporting attestation manifest sha256:9b213910467865818b0df74acc440eca65cf2ea7222795df78962970af53a1fb                                      0.0s
 => => exporting manifest list sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                             0.0s
 => => naming to moby-dangling@sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                             0.0s
 => => unpacking to moby-dangling@sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                          0.0s

Before this:

    docker build --build-arg ALPINE_VERSION=3.18 --build-arg GO_VERSION=1.20.13 --target integration-tests .
     > [dnsname 3/3] RUN --mount=target=/root/.cache,type=cache   set -e; make binaries; mv bin/dnsname /usr/bin/dnsname:
    0.435 GO111MODULE=on go build -mod=vendor -ldflags '-X main.gitCommit=18822f9a4fb35d1349eb256f4cd2bfd372474d84' -o bin/dnsname github.com/containers/dnsname/plugins/meta/dnsname
    0.610 # runtime/cgo
    0.610 In file included from _cgo_export.c:3:
    0.610 /usr/include/fortify/stdlib.h:23:15: fatal error: stdlib.h: No such file or directory
    0.610    23 | #include_next <stdlib.h>
    0.610       |               ^~~~~~~~~~
    0.610 compilation terminated.

With this patch:

    docker build --build-arg ALPINE_VERSION=3.18 --build-arg GO_VERSION=1.20.13 --target integration-tests .
    ...
     => exporting to image                                                                                                                             0.0s
     => => exporting layers                                                                                                                            0.0s
     => => exporting manifest sha256:59323c8f3ae7d6510ad7d89304e1315d73d5171dbbaca1bb76fbabcd8c100d28                                                  0.0s
     => => exporting config sha256:3c98c4ca486e2e0c4dd4d7625c70d10bd15d0df8e7385a99f7ccd83d5f65c93f                                                    0.0s
     => => exporting attestation manifest sha256:9b213910467865818b0df74acc440eca65cf2ea7222795df78962970af53a1fb                                      0.0s
     => => exporting manifest list sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                             0.0s
     => => naming to moby-dangling@sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                             0.0s
     => => unpacking to moby-dangling@sha256:e26824a918764287b592f250fdfcc7dd7c60f70534075f96f4fd2f9499466f81                                          0.0s

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@tonistiigi
Copy link
Member

It's surprising that this broke when alpine version did not even change. I wonder if something has gone wrong in the base images (or alpine maintainers did some mistake when picking packages to 3.18).

@thaJeztah
Copy link
Member Author

It broke in Moby CI when running with go 1.20.13; alpine 3.17 has been sunset and the official images moved to alpine 3.18 as minimum.

@thaJeztah
Copy link
Member Author

@tonistiigi all green; this one good to merge?

@tonistiigi tonistiigi merged commit 435cb77 into moby:v0.11 Jan 24, 2024
41 checks passed
@tonistiigi
Copy link
Member

I looked at it wrong and thought the Dockerfile already used 3.18 by default.

@thaJeztah thaJeztah deleted the 0.11_fix_alpine branch January 24, 2024 01:24
@thaJeztah thaJeztah self-assigned this Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants