Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docker] Add support for arm32/64 (#2104)
- Loading branch information
Showing
5 changed files
with
78 additions
and
1 deletion.
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
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,10 @@ | ||
#!/bin/bash | ||
|
||
# Custom build script to build images for all supported architectures. | ||
# Example for IMAGE_NAME: rss-builder/rss-builder:stable | ||
|
||
for arch in amd64 arm32v7 arm64v8 | ||
do | ||
echo "Building $IMAGE_NAME-$arch" | ||
docker build --build-arg FROM_ARCH=$arch --file $DOCKERFILE_PATH --tag $IMAGE_NAME-$arch . | ||
done |
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Use manifest-tool to create the manifest, given the experimental | ||
# "docker manifest" command isn't available yet on Docker Hub. | ||
MANIFEST_TOOL_VERSION=$(curl -s https://api.github.com/repos/estesp/manifest-tool/releases/latest | grep 'tag_name' | cut -d\" -f4) | ||
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/$MANIFEST_TOOL_VERSION/manifest-tool-linux-amd64 | ||
chmod +x manifest-tool | ||
|
||
# Generate the manifest file. | ||
# Parameter 1 is the multi-arch image name, e.g. rss-bridge/rss-bridge:stable | ||
function generate_manifest { | ||
cat > manifest-generated.yaml << EOF | ||
image: $1 | ||
manifests: | ||
- image: $1-amd64 | ||
platform: | ||
architecture: amd64 | ||
os: linux | ||
- image: $1-arm32v7 | ||
platform: | ||
architecture: arm | ||
os: linux | ||
variant: v7 | ||
- image: $1-arm64v8 | ||
platform: | ||
architecture: arm64 | ||
os: linux | ||
variant: v8 | ||
EOF | ||
} | ||
|
||
echo "Pushing multi-arch manifest $IMAGE_NAME" | ||
generate_manifest $IMAGE_NAME | ||
./manifest-tool push from-spec manifest-generated.yaml |
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,5 @@ | ||
#!/bin/bash | ||
|
||
# Register qemu-*-static for all supported processors except the | ||
# current one, but also remove all registered binfmt_misc before | ||
docker run --rm --privileged multiarch/qemu-user-static:register --reset |
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,9 @@ | ||
#!/bin/bash | ||
|
||
# Custom build script to push images for all supported architectures. | ||
|
||
for arch in amd64 arm32v7 arm64v8 | ||
do | ||
echo "Pushing $IMAGE_NAME-$arch" | ||
docker push $IMAGE_NAME-$arch | ||
done |