Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generic dockerfile for statically compiled Crystal applications
# See https://wjwh.eu/posts/2019-07-21-static-crystal-images.html for the reasoning behind each line
# Build stage
FROM durosoft/crystal-alpine:0.28.0 as build
COPY shard.yml shard.yml
RUN shards install --production
COPY . ./
RUN crystal build src/my_app.cr --release --static
# Release stage
FROM alpine:3.10
COPY --from=0 my_app my_app
EXPOSE 3000 # Or whichever other port you want exposed, if any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.