crystal
build a statically linked program¶
since musl-libc is a better option to build a statically linked binary, use Docker or Podmn to build your binary
podman run --rm -it -v $(pwd):/workspace -w /workspace crystallang/crystal:latest-alpine crystal build src/teste.cr --release --no-debug --progress --static
the same, but as Dockerfile
FROM crystallang/crystal:latest-alpine as builder
WORKDIR /src
COPY . .
RUN crystal build src/teste.cr --release --no-debug --progress --static
FROM scratch
COPY --from=builder /src/teste /teste
ENTRYPOINT ["/teste"]
create the image using