Skip to content

Instantly share code, notes, and snippets.

@samueleaton
Last active September 23, 2017 18:43
Show Gist options
  • Save samueleaton/d112ab5cfac7b707fdd2b1e4ec110d43 to your computer and use it in GitHub Desktop.
Save samueleaton/d112ab5cfac7b707fdd2b1e4ec110d43 to your computer and use it in GitHub Desktop.
Crystal Docker for development
FROM crystallang/crystal:0.22.0
MAINTAINER sam@eaton.party
WORKDIR /app
# copy all your app files/directories to image
COPY static ./static
COPY dev ./dev
COPY spec ./spec
COPY src ./src
COPY shard.yml ./shard.yml
# install crystal deps
RUN shards install
RUN crystal build --release dev/sentry_cli.cr -o ./sentry
# run sentry, which starts app and watches files
CMD ./sentry
# build image
docker build -f dev.dockerfile -t my_app .
# run image
# port 7777 on local machine is mapped to port 80 in container
docker run --name my_app -p 7777:80 my_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment