Improve docker compose performance (#347)   🤩

* Fix warning Integrity check: System parameters don't match

* Reduce commands required to use docker-compose and update quick-setup doc

Data will still persist when stopping and restarting containers.
To destroy the data can use docker-compose down --volumes

* Moved webpacker-dev-server to its own service

* cache bundle and yarn - improve volume performance - env conditional statements

* Fix inconsistent build results found during testing
This commit is contained in:
petebytes
2019-12-05 04:12:46 -07:00
committed by Sony Mathew
parent 3a1c0aef07
commit 3f403c9e7a
6 changed files with 88 additions and 37 deletions

View File

@@ -1,12 +1,27 @@
version: '3'
volumes:
postgres:
redis:
bundle:
packs:
node_modules:
services:
server: &server
build:
context: .
dockerfile: ./docker/Dockerfile
args:
BUNDLE_WITHOUT: ''
RAILS_ENV: 'development'
RAILS_SERVE_STATIC_FILES: 'false'
volumes:
- ./:/app
- ./:/app:cached
- bundle:/bundle:delegated
- packs:/app/public/packs
- node_modules:/app/node_modules
links:
- postgres
- redis
@@ -16,8 +31,25 @@ services:
- REDIS_URL=redis://redis:6379
- POSTGRES_HOST=postgres
- RAILS_ENV=development
command: ["foreman", "start", "-f", "./docker/Procfile.docker.dev"]
- WEBPACKER_DEV_SERVER_HOST=webpacker
command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]
webpacker:
<<: *server
command: ./bin/webpack-dev-server
depends_on:
- "server"
ports:
- '3035:3035'
volumes:
- .:/app:cached
- bundle:/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
environment:
- "NODE_ENV=development"
- "RAILS_ENV=development"
- "WEBPACKER_DEV_SERVER_HOST=0.0.0.0"
postgres:
image: postgres:9.6
restart: always
@@ -37,9 +69,3 @@ services:
- redis:/data/redis
ports:
- '6379:6379'
volumes:
postgres:
external: true
redis:
external: true