Closed maxacarvalho closed 3 years ago
I will take a look at it.
I thought it would be as simple as running a multi-arch build... Wasn't the case. It failed after 6.5h.
Could you try building the containers on your machine by running ./update.sh
?
It will fail to push to Docker Hub but the build should run anyways.
If there are any errors which will fail the build we can take a look at it together.
You will need to remove an if statement that checks if the version you are trying to build already exists on Docker Hub.
Hi @chdanielmueller
Maybe I'm missing something but, when I run ./update.sh
nothing happens, I just get the message saying the script completed creating and pushing the docker images.
Please try replacing the update.sh content with this:
#!/bin/bash
trap killgroup SIGINT
function killgroup() {
echo killing...
kill 0
}
function generated_warning() {
cat <<-EOH
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
EOH
}
function docker_tag_exists() {
curl --silent -f -lSL https://index.docker.io/v1/repositories/$1/tags/$2 &> /dev/null
}
# wkhtmltopdf versions
for version in \
0.12.6 \
; do
# edition small (contains only wkhtmltopdf) or full (with wkhtmltopdf, wkhtmltoimage and lib)
for edition in \
small \
full \
; do
# Supported base images
for image in \
alpine:3.13.5 \
node:14.16.1-alpine3.13 \
python:3.9.5-alpine3.13 \
; do
# Parse image string
base="${image%%:*}"
baseVersion="${image##*:}"
baseVersionClean="${baseVersion%%-*}"
# Apply patch based on edition
case "$edition" in
small)
replaceRules="
/%%EDITION1%%/d;
/%%EDITION2%%/d;
"
;;
full)
replaceRules="
s/%%EDITION1%%/COPY --from=builder \/bin\/wkhtmltoimage \/bin\/wkhtmltoimage/g;
s/%%EDITION2%%/COPY --from=builder \/lib\/libwkhtmltox* \/bin\//g;
"
;;
esac
# Check for base OS type (currently only alpine)
case "$image" in
alpine*)
os="alpine"
template="Dockerfile-alpine.template"
replaceRules+="
s/%%IMAGE%%/$image/g;
s/%%WKHTMLTOXVERSION%%/$version/g;
s/%%END%%/ENTRYPOINT [\"wkhtmltopdf\"]/g;
"
;;
*alpine*)
os="alpine"
template="Dockerfile-alpine.template"
replaceRules+="
s/%%IMAGE%%/$image/g;
s/%%WKHTMLTOXVERSION%%/$version/g;
/%%END%%/d;
"
;;
*)
echo "WARNING: OS Type not supported"
exit
;;
esac
case "$image" in
alpine*)
replaceRules+="
s/%%BUILDER%%/$image/g;
"
;;
node*)
replaceRules+="
s/%%BUILDER%%/alpine:3.13/g;
"
;;
python*)
replaceRules+="
s/%%BUILDER%%/alpine:3.13/g;
"
;;
*)
echo "WARNING: OS Type not supported"
exit
;;
esac
# Prepare imageName and tag
if [ "$os" == "$base" ]; then
imageName="$base-wkhtmltopdf"
else
imageName="$os-$base-wkhtmltopdf"
fi
tag="$baseVersionClean-$version-$edition"
dir="archive/$imageName"
file="Dockerfile_$tag"
# Prepare Dockerfile
mkdir -p "$dir"
{ generated_warning; cat "$template"; } > "$dir/$file"
sed -i.bak -e "$replaceRules" "$dir/$file"
# Build container
echo "Starting build for surnet/$imageName:$tag"
docker build . -f "$dir/$file" -t "surnet/$imageName:$tag" \
&& docker tag "surnet/$imageName:$tag" "ghcr.io/surnet/$imageName:$tag" \
&& echo "Successfully built and pushed surnet/$imageName:$tag" || echo "Building or pushing failed for surnet/$imageName:$tag"
done
done
done
wait
echo "###########################################################
The script completed creating and pushing docker images
###########################################################"
Hi @chdanielmueller, it's running now, I'll let you know once it's finished.
Hi again @chdanielmueller The build finished and I can confirm that it works 😃
That's great to hear. 👍
Could you please run docker manifest inspect --verbose surnet/alpine-wkhtmltopdf:3.13.5-0.12.6-small
and send me the output?
It seems like I have got some homework to get multi-arch builds up and running. Sounds like a great job for a Raspberry Pi 😄
Absolutely, here it is:
{
"Ref": "docker.io/surnet/alpine-wkhtmltopdf:3.13.5-0.12.6-small",
"Descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:127bd13de93d6e16b432237919dca94136935dc6e32e40562e11199d6904bacc",
"size": 1159,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
"SchemaV2Manifest": {
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 1855,
"digest": "sha256:841d20447378b2f10e64acd95cfd75bf9c82e95eb1fd75c9035b8d9c388d8115"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 2811969,
"digest": "sha256:540db60ca9383eac9e418f78490994d0af424aab7bf6d0e47ac8ed4e2e9bcbba"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 218,
"digest": "sha256:9a8675c824e8780db120fb4cc56794d4c567dcd2a102578ae546cdfd234c8c50"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 28530147,
"digest": "sha256:f156b6965352758d5e677a51c169a2506ef347b103ae179f0366f938f2082387"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 18242328,
"digest": "sha256:3d86168cfb00ded15af0d42d87af785b47f153045530e586c43176a2624d6038"
}
]
}
}
Thank you very much for that @chdanielmueller
Sorry. I would need the output for docker image inspect surnet/alpine-wkhtmltopdf:3.13.5-0.12.6-small
too.
docker manifest inspect
gets the information from Docker Hub...
Thank you
No problem,
[
{
"Id": "sha256:6e332ff118e9597e132c5098ffa780e15d747c9db9b8ac2d91910e0952e18071",
"RepoTags": [
"surnet/alpine-wkhtmltopdf:3.13.5-0.12.6-small",
"ghcr.io/surnet/alpine-wkhtmltopdf:3.13.5-0.12.6-small"
],
"RepoDigests": [],
"Parent": "",
"Comment": "buildkit.dockerfile.v0",
"Created": "2021-05-20T09:14:07.712724125Z",
"Container": "",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": null,
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"DockerVersion": "",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"wkhtmltopdf"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "arm64",
"Os": "linux",
"Size": 105801306,
"VirtualSize": 105801306,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/0atzvw8utqr4u9g40kd0k0xm7/diff:/var/lib/docker/overlay2/grncudeahdnm3somf6bpoey5q/diff:/var/lib/docker/overlay2/2aa14bdbcf562346a71b4b54f35ca3b462b6c9978a0e3a72bf643d47f0fca67a/diff",
"MergedDir": "/var/lib/docker/overlay2/009djn3ex98933urqkn36rerq/merged",
"UpperDir": "/var/lib/docker/overlay2/009djn3ex98933urqkn36rerq/diff",
"WorkDir": "/var/lib/docker/overlay2/009djn3ex98933urqkn36rerq/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:c55d5dbdab4094da9ba390de49be10dd3b42e990670236a81a792fd2c933fceb",
"sha256:385094f7b804db661896364c406214383e9310b3c5ce22b8e10f17eae7a34c63",
"sha256:2c6e884840000cfad9f395d1629c595f99c974ab9c908eeb3da74b2ae7f1f7ee",
"sha256:9be4b134878125fab3803660726a0b454ba8b373290ff2a905803916355be1c4"
]
},
"Metadata": {
"LastTagTime": "2021-05-20T09:14:08.562833084Z"
}
}
]
New versions will be multiarch. amd64 and arm64 😃 I was able to build it on a Raspberry Pi in 2.5h. Changes to the update script in: cbd552bcb04690da5bb9c57d84c0961df9ce08a1
@maxacarvalho If you could delete your local image and try to pull and test the uploaded one that would be great.
Hello @chdanielmueller
Sorry for the delay.
I can confirm that's now working perfectly 👌🏽
Thank you very much for your help here 🙇🏽 🙇🏽 🙇🏽
Wow very nice work @chdanielmueller, I noticed right away from the README that this repo is next level :ok_hand: (not just a Dockerfile dumped here, and from experience I know that multi-arch images are not just "enable ARM64 compilation"). Good job on this repo altogether!
Hi @joonas-fi
Thank you for the feedback. I hope you enjoy the image.
Cheers, Daniel
I'm getting an error message:
/lib/ld-musl-x86_64.so
, which of course it will not be present on Apple Silicon builds, so I wonder if you have an idea about how to fix that?Thanks.