webmatze / crystal_docker_helloworld_sample

How to build a docker application image using a crystal binary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello World Crystal in Docker Example

Install dependencies

brew install crystal

Run

crystal helloworld.cr

Build

We need to build the statically linked binary using alpine linux. So we are using docker:

docker run --rm -it -v $PWD:/workspace -w /workspace crystallang/crystal:0.32.1-alpine crystal build helloworld.cr --static

or just use the includes build script

./build

build Docker image

docker build -t helloworld .

run Docker container

docker run --name helloworld helloworld

References

About

How to build a docker application image using a crystal binary


Languages

Language:Shell 48.6%Language:Dockerfile 44.6%Language:Crystal 6.8%