Created
March 24, 2018 01:17
-
-
Save t0nyandre/9ce9037b1b1055c2dc0d2f88a50ca3a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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