Guest User

Untitled

a guest
Apr 1st, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ### Dockerfile
  2.  
  3. FROM crystallang/crystal
  4.  
  5. WORKDIR /usr/app
  6.  
  7. COPY ./ ./
  8.  
  9. RUN shards install
  10.  
  11.  
  12.  
  13. ### docker-compose.yml
  14.  
  15. version: "3"
  16.  
  17. services:
  18. blog:
  19. build: .
  20. command:
  21. - /bin/sh
  22. - -c
  23. - |
  24. sh checkshards.sh
  25. crystal run ./src/main.cr
  26. volumes:
  27. - .:/usr/app
  28. - ./.shards:/usr/app/.shards
  29. ports:
  30. - "3000:3000"
  31. depends_on:
  32. - postgres
  33. environment:
  34. PG_USER: usr
  35. PG_PW: pw
  36. PG_DB: usr
  37.  
  38. postgres:
  39. image: postgres:10.3-alpine
  40. volumes:
  41. - ./data:/custom/path/to/data
  42. ports:
  43. - "5432:5432"
  44. environment:
  45. POSTGRES_PASSWORD: pw
  46. POSTGRES_USER: usr
  47. PGDATA: /custom/path/to/data
  48.  
  49.  
  50.  
  51. ### checkshards.sh
  52.  
  53. if shards check | grep 'shards install'
  54. then
  55. shards install
  56. else
  57. echo 'All the shards are installed. Will continue building docker.'
  58. fi
Add Comment
Please, Sign In to add comment