Skip to content

Instantly share code, notes, and snippets.

@t0nyandre
Created March 24, 2018 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t0nyandre/9ce9037b1b1055c2dc0d2f88a50ca3a0 to your computer and use it in GitHub Desktop.
Save t0nyandre/9ce9037b1b1055c2dc0d2f88a50ca3a0 to your computer and use it in GitHub Desktop.
### Dockerfile
FROM crystallang/crystal
WORKDIR /usr/app
COPY ./ ./
RUN shards install
### docker-compose.yml
version: "3"
services:
blog:
build: .
command:
- /bin/sh
- -c
- |
sh checkshards.sh
crystal run ./src/main.cr
volumes:
- .:/usr/app
- ./.shards:/usr/app/.shards
ports:
- "3000:3000"
depends_on:
- postgres
environment:
PG_USER: usr
PG_PW: pw
PG_DB: usr
postgres:
image: postgres:10.3-alpine
volumes:
- ./data:/custom/path/to/data
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: pw
POSTGRES_USER: usr
PGDATA: /custom/path/to/data
### checkshards.sh
if shards check | grep 'shards install'
then
shards install
else
echo 'All the shards are installed. Will continue building docker.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment