-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Dockerfile: update ALPINE_VERSION to 3.18 #4354
Conversation
Ah, found the culprit; it's not Go, but the alpine upgrade;
the Given the input Go files x.go and y.go, cgo generates these source
files:
x.cgo1.go # for gc (cmd/compile)
y.cgo1.go # for gc
_cgo_gotypes.go # for gc
_cgo_import.go # for gc (if -dynout _cgo_import.go)
x.cgo2.c # for gcc
y.cgo2.c # for gcc
_cgo_defun.c # for gcc (if -gccgo)
_cgo_export.c # for gcc
_cgo_export.h # for gcc
_cgo_main.c # for gcc
_cgo_flags # for alternative build tools |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #4354 +/- ##
=======================================
Coverage 59.75% 59.75%
=======================================
Files 287 287
Lines 24821 24821
=======================================
Hits 14832 14832
Misses 9103 9103
Partials 886 886 |
It looks like there's a couple of options; remove
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build-base-alpine | |
COPY --from=xx / / | |
RUN apk add --no-cache bash clang lld llvm file git | |
WORKDIR /go/src/github.com/docker/cli | |
FROM build-base-alpine AS build-alpine | |
ARG TARGETPLATFORM | |
# gcc is installed for libgcc only | |
RUN xx-apk add --no-cache musl-dev gcc |
add musl-dev
to build-base-alpine
Adding musl-dev
brings the header
Reproduce
Here's a minimal dockerfile and build-args to test the variants;
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION=3.17
ARG BASE=default
FROM golang:1.20-alpine${ALPINE_VERSION} AS base-no-clang
FROM base-no-clang AS base-default
RUN apk add --no-cache clang
FROM base-default AS base-clang-musl-dev
RUN apk add --no-cache musl-dev
FROM base-${BASE}
ARG GOTESTSUM_VERSION=v1.8.2
RUN --mount=type=cache,target=/go/pkg/mod \
go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" && gotestsum --version
x | ALPINE_VERSION | clang? | musl-dev? | cmd |
---|---|---|---|---|
✅ | 3.17 | - | - | docker build --build-arg BASE=no-clang . |
✅ | 3.17 | ✅ | - | docker build . |
✅ | 3.17 | ✅ | ✅ | docker build --build-arg BASE=clang-musl-dev . |
✅ | 3.18 | - | - | docker build --build-arg ALPINE_VERSION=3.18 --build-arg BASE=no-clang . |
❌ | 3.18 | ✅ | - | docker build --build-arg ALPINE_VERSION=3.18 . |
✅ | 3.18 | ✅ | ✅ | docker build --build-arg ALPINE_VERSION=3.18 --build-arg BASE=clang-musl-dev . |
From a discussion on Slack; after installing clang alpine 3.17: / # find / | grep stdlib.h
/usr/include/c++/12.2.1/tr1/stdlib.h
/usr/include/c++/12.2.1/stdlib.h alpine 3.18 / # find / | grep stdlib.h
/usr/lib/llvm16/lib/clang/16/include/__clang_hip_stdlib.h
/usr/include/fortify/stdlib.h
/usr/include/c++/12.2.1/tr1/stdlib.h
/usr/include/c++/12.2.1/stdlib.h |
3f2b5c7
to
e972730
Compare
LOL, I was wondering why the e2e tests were failing, and was looking through logs, but couldn't find an actual failure there; make -f docker.Makefile test-e2e-non-experimental
#6 [2/2] COPY ./notary/ /fixtures/
#6 CACHED
#7 exporting to image
#7 exporting layers done
#7 writing image sha256:caf0815eaa7da5cd65244aa32318f904951ed74e2ee2c3c5bad2af2ed299d85e done
#7 naming to docker.io/library/cliendtoendsuite-notary-server done
#7 DONE 0.0s
Container cliendtoendsuite-notary-server-1 Running
Container cliendtoendsuite-evil-notary-server-1 Running
Container cliendtoendsuite-registry-1 Running
Container cliendtoendsuite-engine-1 Running
Error: No such object: cliendtoendsuite_engine_1
make: *** [docker.Makefile:142: test-e2e-non-experimental] Error 1 And it was staring me in the face:
Looks like something in the e2e tests is expecting compose to be creating containers using underscores, and we're installing docker-compose from alpine's package repositories; and it looks like alpine 3.18 switched over to use compose v2: On alpine 3.17: make -f docker.Makefile build-e2e-image
docker run --rm docker-cli-e2e docker-compose --version
docker-compose version 1.29.2, build unknown On alpine 3.18: make -f docker.Makefile build-e2e-image
docker run --rm docker-cli-e2e docker-compose --version
Docker Compose version v2.17.3 |
6d8bb42
to
273c3ef
Compare
273c3ef
to
f945b5b
Compare
Dockerfile
Outdated
RUN apk add --no-cache bash clang lld llvm file git | ||
RUN apk add --no-cache bash clang lld llvm musl-dev file git | ||
WORKDIR /go/src/github.com/docker/cli | ||
|
||
FROM build-base-alpine AS build-alpine | ||
ARG TARGETPLATFORM | ||
# gcc is installed for libgcc only | ||
RUN xx-apk add --no-cache musl-dev gcc | ||
RUN xx-apk add --no-cache gcc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worked around this by not using cgo
for gotestsum
, but wondering if we still need this, or something similar, but not sure if musl-dev
must be installed through xx
here, or if it's safe to install it using a plain apk add
/cc @crazy-max perhaps you have ideas here
f945b5b
to
d2d4be9
Compare
This also moves `musl-dev` to the alpine-base stage, due to changes in Alpine 3.18 causing gotestsum build to fail because stdlib.h was missing; docker#17 5.065 # runtime/cgo docker#17 5.065 In file included from _cgo_export.c:3: docker#17 5.065 /usr/include/fortify/stdlib.h:23:15: fatal error: stdlib.h: No such file or directory docker#17 5.065 23 | #include_next <stdlib.h> docker#17 5.065 | ^~~~~~~~~~ alpine 3.17: / # find / | grep stdlib.h /usr/include/c++/12.2.1/tr1/stdlib.h /usr/include/c++/12.2.1/stdlib.h alpine 3.18 / # find / | grep stdlib.h /usr/lib/llvm16/lib/clang/16/include/__clang_hip_stdlib.h /usr/include/fortify/stdlib.h /usr/include/c++/12.2.1/tr1/stdlib.h /usr/include/c++/12.2.1/stdlib.h Signed-off-by: Sebastiaan van Stijn <[email protected]>
d2d4be9
to
6a74a63
Compare
Alright, this one is happy now as well; no longer had to change the /cc @crazy-max ptal 🤗 |
This also moves
musl-dev
to the alpine-base stage, due to changes inAlpine 3.18 causing gotestsum build to fail because stdlib.h was missing;
alpine 3.17:
alpine 3.18
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)