crystal-lang / distribution-scripts

40 stars 24 forks source link

Integrate aarch64 into the building /release process #125

Open beta-ziliani opened 3 years ago

beta-ziliani commented 3 years ago

Right now aarc64 tasks are run by CI, but they aren't really part of the build process.

straight-shoota commented 3 years ago

It seems like circli has arm support now: https://circleci.com/build-environments/arm/ That should make this easier.

jhass commented 3 years ago

What was the reason again that we keep circle around for only the release builds?

Anyhow, not that setting up a self hosted runner for it on our build machine should be too difficult https://circleci.com/docs/2.0/runner-overview/

beta-ziliani commented 3 years ago

Unfortunately we can't run self-hosted runners on Circle CI. About why use Circle CI only for release builds is merely a matter of balancing the workload.

stakach commented 2 years ago

84codes provides a range of multi-arch images https://hub.docker.com/r/84codes/crystal/tags

They also have multi-arch packages for most linux distros https://github.com/84codes/crystal-container-images So you can easily add the deb package and install crystal on a raspberry pi for example

bendangelo commented 9 months ago

Hi, I'm having some issues using 84codes crystal base images (because they have arm64 versions).

Edit: For get that comment, the 84codes images entrypoint is different from the crystal base image. I've fixed the issue on my end.

mloughran commented 9 months ago

I settled on using alpine's crystal binaries, and have had no issues whatsoever (having also had some different issues with the 84codes images).

Our Dockerfile looks like this, but you could simplify (and remove static build dependencies) if you don't care about having a separate build container, or use alpine:edge if you'd rather use the latest crystal than an alpine release branch (see packages):

FROM alpine:3.19 as build
RUN apk add crystal shards
RUN apk add openssl-dev yaml-dev zlib-dev \
  # Static build dependencies
  openssl-libs-static yaml-static zlib-static

WORKDIR /app
COPY shard.lock .
COPY shard.yml .
RUN shards install --production
COPY . .

RUN shards build <target> --static

FROM alpine:3.19
WORKDIR /
COPY --from=build /app/bin/<target> .
CMD ["/<target>"]