Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Docker Compose
@kon_yu






[PR]Best Teacher
Best Teacher
Best Teacher
2.
1. Writing
3. Skype
Rails
• DB SQLite3 -> bundle install
• Ruby
• native extention(nokogiri )
• PostgteSQL Redis
•
•
Docker
Docker 

Docker for mac Docker for window 

VirtualBox




->
Docker
Rails
docker-compse.yml
Docker Compose
• Mac
•DBMS PostgreSQL
•Redis
•Memcached
•Elasticsearch ( )
Rails
!"" Docker
# !"" elasticsearch
# #   %"" Dockerfile #kuromoji image
# %"" rails
# %"" Dockerfile #rails
!"" build_do...
docker-compose.yml
version: '2'
services:
postgres:
image: postgres:9.5.4
# localhost:5432
ports:
- 5432:5432
memcached:
image: memcached:1.4...
version: ‘2'
…
services:
rails:
build:
context: .
dockerfile: Docker/rails/Dockerfile
tty: true
ports:
- 3000:3000 # local...
Rails Dockerfile
FROM ruby:2.3.1 #Ruby
# git
RUN apt-get update
#vim
RUN apt-get install -y git emacs24-nox vim
# Workspace...
…
# Rails
RUN apt-get install -y libsqlite3-dev
RUN gem install bundler
# Dockerfile bundle install
# Gemfile Gemfile.lock...
DB
Makefile
Makefile docker npm install db
# Docker Step1
build_dockers:
docker build -t es_1.7.5 -f Docker/elasticsearch/D...
PC 

Docker
rails(docker-pomose.ymal ) bash
> docker-compose exec rails bash
# Rails 

root@xxxx:# bin/rails server

#
roo...
bundle install --path vendor/bundle Rails server
)https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow...
• Docker Compose
• /
•
• Docker
Best Teacher
2.
1. Writing
3. Skype
Rails
Docker composeで開発環境をメンバに配布せよ
Upcoming SlideShare
Loading in …5
×

Docker composeで開発環境をメンバに配布せよ

4,832 views

Published on

第一回スタートアップRails勉強会(http://connpass.com/event/39963/)
登壇資料

Published in: Technology
  • Be the first to comment

Docker composeで開発環境をメンバに配布せよ

  1. 1. Docker Compose @kon_yu
  2. 2. 
 
 

  3. 3. [PR]Best Teacher
  4. 4. Best Teacher
  5. 5. Best Teacher 2. 1. Writing 3. Skype
  6. 6. Rails • DB SQLite3 -> bundle install • Ruby • native extention(nokogiri )
  7. 7. • PostgteSQL Redis • •
  8. 8. Docker Docker 
 Docker for mac Docker for window 
 VirtualBox 
 
 ->
  9. 9. Docker Rails docker-compse.yml Docker Compose
  10. 10. • Mac •DBMS PostgreSQL •Redis •Memcached •Elasticsearch ( )
  11. 11. Rails !"" Docker # !"" elasticsearch # #   %"" Dockerfile #kuromoji image # %"" rails # %"" Dockerfile #rails !"" build_docker_container.sh # !"" docker-compose.yml #Docker Compose !"" Gemfile #gem !"" Gemfile.lock #gem !"" package.js # !"" Rails
  12. 12. docker-compose.yml
  13. 13. version: '2' services: postgres: image: postgres:9.5.4 # localhost:5432 ports: - 5432:5432 memcached: image: memcached:1.4.31 elasticsearch: #Docker Offical ES image kuromoji image: es_1.7.5 redis: image: redis:3.0.7 …
  14. 14. version: ‘2' … services: rails: build: context: . dockerfile: Docker/rails/Dockerfile tty: true ports: - 3000:3000 # localhost:3000 environment: # ELASTICSEARCH_URL: http://elasticsearch:9200 ELASTICSEARCH_TEST_URL: http://elasticsearch:9300 volumes: # : - ./:/usr/src/app links:# rails 
 #database.yml host postgres Postgres - postgres - memcached - elasticsearch - redis
  15. 15. Rails Dockerfile FROM ruby:2.3.1 #Ruby # git RUN apt-get update #vim RUN apt-get install -y git emacs24-nox vim # Workspace RUN mkdir -p /usr/src/app WORKDIR /usr/src/app
  16. 16. … # Rails RUN apt-get install -y libsqlite3-dev RUN gem install bundler # Dockerfile bundle install # Gemfile Gemfile.lock COPY Gemfile /usr/src/app/ COPY Gemfile.lock /usr/src/app/ # Gemfile github: "activeadmin" RUN bundle config git.allow_insecure true RUN bundle install --jobs 4 # RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN apt-get install -y nodejs RUN npm install RUN apt-get clean
  17. 17. DB Makefile Makefile docker npm install db # Docker Step1 build_dockers: docker build -t es_1.7.5 -f Docker/elasticsearch/Dockerfile . docker-compose up # Docker Step2 dev_env_init: docker-compose exec rails npm install docker-compose exec rails bundle exec rake db:reset docker-compose exec rails bundle exec rake db:seed_fu ——— make build_dockers make dev_env_init
  18. 18. PC 
 Docker rails(docker-pomose.ymal ) bash > docker-compose exec rails bash # Rails 
 root@xxxx:# bin/rails server
 # root@xxxx:# bin/rspec #js root@xxxx:# npm run watch
  19. 19. bundle install --path vendor/bundle Rails server )https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076 memcached redis elasticsearch postgres rails 2GB 4GB seed busybox
  20. 20. • Docker Compose • / • • Docker
  21. 21. Best Teacher 2. 1. Writing 3. Skype
  22. 22. Rails

×