Just wanted to ask anyone if they have any working ARM docker images for latest Crystal? I made one a while back and I haven’t been able to update it to the latest Crystal because I use the deb installer from 2016. I’d love for the Crystal team to release an official docker build for ARM. I am currently working on a Dockerfile for the new version using this article.
Because I want to Dockerize it so I can run it in swarm mode, as well as make it easier to reinstall RPis that I have with Crystal. Look up what Docker does and you’ll understand why we need this. I’m not compiling Crystal from scratch every time I need a higher version.
I know what docker does, i used it before. But I was wondering why you would need the compiler itself on many instances, and not just have it on one system, where you compile the binary you then deploy?
edit: I have crystal on one PI and basically only change to a new compiler version when I do a new major release of our software so everything is thoroughly tested, and that does not happen very often.
Ok then you should understand why this would be useful. People build docker images, they will want to build docker images based off crystal. The literal draw of docker is “containerized development tools”. Naturally people will want the crystal compiler in a docker image. Some people don’t want to need to rebuild crystal for their platform from scratch when we can dockerize the whole process and make it way simpler for ARM users to use crystal.
I know this is an old topic and I don’t think my original solution actually crossed compiled
However spider-gazelle will now build multi-architecture images with the updated Dockerfile and the same buildx command
you can enable buildx from the command line with: docker buildx create --use
As local docker doesn’t support multi-arch images you need to push them and then download them again to use them. However if you want to test your image before pushing, you can do it locally with a single platform specified:
I consider i build successful in my X86_64 linux laptop for a linux/arm64 platform, use following command.
╰─ $ 130 docker buildx build --platform linux/arm64 --target build -t arm64 .
WARNING: No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 2.0s (16/16) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.74kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3.16 2.0s
=> [build 1/12] FROM docker.io/library/alpine:3.16@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad 0.0s
=> => resolve docker.io/library/alpine:3.16@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 148B 0.0s
=> CACHED [build 2/12] WORKDIR /app 0.0s
=> CACHED [build 3/12] RUN adduser --disabled-password --gecos "" --home "/nonexistent" --shell "/sbin/nologin" --no-create-home --uid "10001" "appuser" 0.0s
=> CACHED [build 4/12] RUN apk add --update --no-cache ca-certificates yaml-dev yaml-static libxml2-dev openssl-dev openssl-libs-static zlib-dev 0.0s
=> CACHED [build 5/12] RUN update-ca-certificates 0.0s
=> CACHED [build 6/12] RUN apk add --update --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main --repository=http://dl-cdn.alpinelinux.org/alpine/edge/com 0.0s
=> CACHED [build 7/12] COPY shard.yml shard.yml 0.0s
=> CACHED [build 8/12] COPY shard.lock shard.lock 0.0s
=> CACHED [build 9/12] RUN shards install --production --ignore-crystal-version 0.0s
=> CACHED [build 10/12] COPY ./src /app/src 0.0s
=> CACHED [build 11/12] RUN shards build --production --release --error-trace 0.0s
=> CACHED [build 12/12] RUN for binary in /app/bin/*; do ldd "$binary" | tr -s '[:blank:]' '\n' | grep '^/' | xargs -I % sh -c 'mkdir -p $(dirname dep 0.0s
What i want is copy the built binary from container into my laptop, but, when i build it done, i can’t found the generated image which i built just now (tag name is: arm64), sure, i can’t copy it out, do you know how to achieve this?
and the generated files are on your local machine in the folder specified.
That said, I’m having issues with libunwind and static builds - exceptions don’t seem to be working for me, still trying to solve that
I think I solved my issue with exceptions too. Need to add these this lib
previously was seeing this with exceptions
Failed to raise an exception: END_OF_STACK
Tried to raise:: Unknown DW_FORM_data16 (Exception)
from usr/lib/crystal/core/crystal/dwarf/info.cr:83:29 in '??'
from usr/lib/crystal/core/crystal/dwarf/info.cr:67:23 in '??'
from usr/lib/crystal/core/exception/call_stack/elf.cr:10:7 in '??'
from src/ldso/dl_iterate_phdr.c:45:1 in '??'