-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Improve to use multi-arch images when building services #250
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3" | ||
|
||
services: | ||
vote: | ||
build: ./vote | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: '3' | ||
|
||
services: | ||
redis: | ||
image: redis:alpine | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3" | ||
|
||
services: | ||
vote: | ||
build: ./vote | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3.2" | ||
|
||
services: | ||
vote: | ||
image: dockersamples/examplevotingapp_vote:dotnet-nanoserver-1809 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: "3.2" | ||
|
||
services: | ||
vote: | ||
image: dockersamples/examplevotingapp_vote:dotnet-nanoserver-sac2016 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ services: | |
- back-tier | ||
|
||
db: | ||
image: postgres:9.4 | ||
image: postgres:12.12-bullseye | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see this compose file bind-mounts various things, including health-checks; would it be "better practice" to have a
|
||
environment: | ||
POSTGRES_USER: "postgres" | ||
POSTGRES_PASSWORD: "postgres" | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||||||||||||||||||||
FROM node:10-slim | ||||||||||||||||||||||||
FROM --platform=$BUILDPLATFORM node:18.0-bullseye-slim | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we're updating these files, we should probably add a
Suggested change
Some other suggestions:
Suggested change
I wonder if we should switch back to |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
# add curl for healthcheck | ||||||||||||||||||||||||
RUN apt-get update \ | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (can't comment on the lines further down) Perhaps we should make this a multi-stage Dockerfile, and move the example-voting-app/result/Dockerfile Lines 9 to 12 in 5edf3f7
Now that FROM scratch AS tini
ARG TINI_VERSION=v0.19.0
ADD --chmod=0755 https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Erm... looks like there's more to fix; this doesn't take multi-arch into account, and always downloads x86 (also looks like it's not statically linked?); https://github.com/krallin/tini/releases/tag/v0.19.0 docker build -t foo -<<'EOF'
FROM scratch AS tini
ARG TINI_VERSION=v0.19.0
ADD --chmod=0755 https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
EOF
docker run --rm foo /tini --version
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory And doesn't work on alpine 😞 ldd /tini
/lib/ld-linux-aarch64.so.1 (0xffffb203e000)
libc.so.6 => /lib/ld-linux-aarch64.so.1 (0xffffb203e000)
Error relocating /tini: __fprintf_chk: symbol not found This looks to work though; FROM scratch AS tini
ARG TINI_VERSION=v0.19.0
ARG TARGETARCH
ADD --chmod=0755 https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
FROM debian:bullseye-slim
COPY --from=tini /tini /tini docker run --rm foo /tini --version
tini version 0.19.0 - git.de40ad0 docker run --rm foo /tini --version
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
tini version 0.19.0 - git.de40ad0 |
||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: '2' | ||
|
||
services: | ||
|
||
sut: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.9-slim | ||
FROM --platform=$BUILDPLATFORM python:3.10-bullseye | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't the
|
||
|
||
# add apache bench (ab) tool | ||
RUN apt-get update \ | ||
|
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'm a bit on the fence on renaming
docker-compose*.yml
tocompose.yml
(also still curious what led to the decision to make it the recommended name); I thinkdocker-compose.yml
is more familiar to users (and more recognisable) thancompose.yml
. (every time I seecompose.yml
, I confuse it forcomposer.json