Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### 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
Add Comment
Please, Sign In to add comment