Skip to content

Commit

Permalink
[0.11] Dockerfile: install musl-dev to fix build on alpine 3.18 and up
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
thaJeztah committed Jan 23, 2024
1 parent d080776 commit 3211c33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN apk add --no-cache git

# gobuild is base stage for compiling go/cgo
FROM golatest AS gobuild-base
RUN apk add --no-cache file bash clang lld pkgconfig git make
RUN apk add --no-cache file bash clang lld pkgconfig git make musl-dev
COPY --link --from=xx / /

# runc source
Expand Down

0 comments on commit 3211c33

Please sign in to comment.