-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from infosiftr/multiarch
Add initial multiarchitecture support via Debian cross-compiled binaries
- Loading branch information
Showing
54 changed files
with
163 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
*.md | ||
*.sh | ||
*/hello | ||
*/nanoserver/hello.txt | ||
**/hello | ||
**/nanoserver/hello.txt | ||
.dockerignore | ||
.git | ||
Dockerfile* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,71 @@ | ||
# explicitly use Debian for maximum cross-architecture compatibility | ||
FROM debian:jessie-slim | ||
FROM debian:stretch-slim | ||
|
||
#RUN dpkg --add-architecture i386 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
gcc \ | ||
libc6-dev \ | ||
make \ | ||
# \ | ||
# gcc-multilib \ | ||
# libc6-dev-i386 \ | ||
# linux-libc-dev:i386 \ | ||
\ | ||
libc6-dev-arm64-cross \ | ||
libc6-dev-armel-cross \ | ||
libc6-dev-armhf-cross \ | ||
libc6-dev-ppc64el-cross \ | ||
libc6-dev-s390x-cross \ | ||
\ | ||
gcc-aarch64-linux-gnu \ | ||
gcc-arm-linux-gnueabi \ | ||
gcc-arm-linux-gnueabihf \ | ||
gcc-powerpc64le-linux-gnu \ | ||
gcc-s390x-linux-gnu \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /usr/src/hello | ||
COPY . . | ||
|
||
RUN set -ex; \ | ||
make clean all test; \ | ||
find \( -name 'hello' -or -name 'hello.txt' \) -exec ls -l '{}' + | ||
make clean all test \ | ||
TARGET_ARCH='amd64' \ | ||
CC='x86_64-linux-gnu-gcc' \ | ||
STRIP='x86_64-linux-gnu-strip' | ||
|
||
RUN set -ex; \ | ||
make clean all \ | ||
TARGET_ARCH='arm32v5' \ | ||
CC='arm-linux-gnueabi-gcc' \ | ||
STRIP='arm-linux-gnueabi-strip' | ||
|
||
RUN set -ex; \ | ||
make clean all \ | ||
TARGET_ARCH='arm32v7' \ | ||
CC='arm-linux-gnueabihf-gcc' \ | ||
STRIP='arm-linux-gnueabihf-strip' | ||
|
||
RUN set -ex; \ | ||
make clean all \ | ||
TARGET_ARCH='arm64v8' \ | ||
CC='aarch64-linux-gnu-gcc' \ | ||
STRIP='aarch64-linux-gnu-strip' | ||
|
||
# TODO TARGET_ARCH='i386' (heinous package conflicts trying to get "gcc -m32"/"gcc-multilib" to work with all the cross-compiling gccs) | ||
|
||
RUN set -ex; \ | ||
make clean all \ | ||
TARGET_ARCH='ppc64le' \ | ||
CC='powerpc64le-linux-gnu-gcc' \ | ||
STRIP='powerpc64le-linux-gnu-strip' | ||
|
||
RUN set -ex; \ | ||
make clean all \ | ||
TARGET_ARCH='s390x' \ | ||
CC='s390x-linux-gnu-gcc' \ | ||
STRIP='s390x-linux-gnu-strip' | ||
|
||
RUN find \( -name 'hello' -or -name 'hello.txt' \) -exec ls -lh '{}' + | ||
|
||
CMD ["./hello-world/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,31 +28,56 @@ dirCommit() { | |
) | ||
} | ||
|
||
generateCommit="$(fileCommit "$self")" | ||
cat <<-EOH | ||
# this file is generated via https://github.com/docker-library/hello-world/blob/$(fileCommit "$self")/$self | ||
# this file is generated via https://github.com/docker-library/hello-world/blob/$generateCommit/$self | ||
Maintainers: Tianon Gravi <[email protected]> (@tianon), | ||
Joseph Ferguson <[email protected]> (@yosifkit) | ||
GitRepo: https://github.com/docker-library/hello-world.git | ||
GitCommit: $generateCommit | ||
EOH | ||
|
||
commit="$(dirCommit "$image")" | ||
# prints "$2$1$3$1...$N" | ||
join() { | ||
local sep="$1"; shift | ||
local out; printf -v out "${sep//%/%%}%s" "$@" | ||
echo "${out#$sep}" | ||
} | ||
|
||
arches=( *"/$image/hello" ) | ||
arches=( "${arches[@]%"/$image/hello"}" ) | ||
|
||
echo | ||
cat <<-EOE | ||
Tags: latest | ||
GitCommit: $commit | ||
Directory: $image | ||
Architectures: $(join ', ' "${arches[@]}") | ||
EOE | ||
for arch in "${arches[@]}"; do | ||
commit="$(dirCommit "$arch/$image")" | ||
cat <<-EOE | ||
$arch-GitCommit: $commit | ||
$arch-Directory: $arch/$image | ||
EOE | ||
done | ||
|
||
if [ -d "$image/nanoserver" ]; then | ||
commit="$(dirCommit "$image/nanoserver")" | ||
winArches=( *"/$image/nanoserver/hello.txt" ) | ||
winArches=( "${winArches[@]%"/$image/nanoserver/hello.txt"}" ) | ||
|
||
if [ "${#winArches[@]}" -gt 0 ]; then | ||
echo | ||
cat <<-EOE | ||
Tags: nanoserver | ||
GitCommit: $commit | ||
Directory: $image/nanoserver | ||
Architectures: $(join ', ' "${winArches[@]/#/windows-}") | ||
EOE | ||
for arch in "${winArches[@]}"; do | ||
commit="$(dirCommit "$arch/$image/nanoserver")" | ||
cat <<-EOE | ||
windows-$arch-GitCommit: $commit | ||
windows-$arch-Directory: $arch/$image/nanoserver | ||
EOE | ||
done | ||
cat <<-EOE | ||
Constraints: nanoserver | ||
EOE | ||
fi |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM scratch | ||
COPY hello / | ||
CMD ["/hello"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters