Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CircleCIで docker-compose最強? / docker-compose-up-on-circleci

CircleCIで docker-compose最強? / docker-compose-up-on-circleci

2019-06-26 五反田.rb #37のLT資料です!
『CircleCIで docker-compose最強?』

https://gotanda-rb.connpass.com/event/135422/

A92d05c5da067dc28a32527430f762ca?s=128

WalkerSumida

June 26, 2019
Tweet

Transcript

  1. $JSDMF$*Ͱ EPDLFSDPNQPTF࠷ڧ גࣜձࣾϚπϦΧ/PUJBࣄۀ੹೚ऀ"ZVNV4VNJEB

  2. ͋ɺࠓ೔ͷ͓୊͸ d34QFDςετʹ͍ͭͯd ͬͯ͜ͱ͸Θ͔͍ͬͯ·͢

  3. ࣗݾ঺հ

  4. גࣜձࣾ ϚπϦΧ 4FOTFT 4'"$3.  /PUJB &NBJM5SBDLJOH  3BJMTPS3FBDU ΤϯδχΞ

    ઈࢍืूதͰ͢ʂ
  5. w େֶߦ͖ͳ͕Β*5ϕϯνϟʔاۀͰ໿೥ؒ༗ঈΠϯλʔϯ w 1)1 .Z42- $BLF1)1 Y 8PSEQSFTT $ "41

    /&5 w ౦ࣳ৘ใγεςϜגࣜձࣾͰ೥ؒϔϧεέΞࣄۀʹैࣄ w 7#/&5 $ 0SBDMF%BUBCBTF w ̍ਓͰىۀ͠Α͏ͱࢼΈΔ͕ࣦഊ w 3VCZPO3BJMT 'VFM1)1 .Z42- "84 "OTJCMF w גࣜձࣾϚπϦΧʹΤϯδχΞೋਓ໨Ͱ+PJO w 4FOTFTͱ/PUJBΛ։ൃӡ༻ w 3VCZPO3BJMT "OHVMBS+4 .Z42- "84 ܦྺ
  6. Έͳ͞Μ͸ϩʔΧϧͷ ։ൃ؀ڥ͸EPDLFSͰߏங͍ͯ͠·͔͢ʁ

  7. ࢲ͸΋͏શͯEPDLFSͰߏங͠ ͍ͯ·͢

  8. mysql: image: mysql:5.7 ports: - 3306:3306 volumes: - ./docker/mysql/conf.d:/etc/mysql/conf.d -

    mysql-data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: root .Z42-ͷىಈ
  9. rails_api: tty: true stdin_open: true build: context: . dockerfile: Dockerfile

    entrypoint: sh /app/docker/bin/wait_for_mysql.sh sh /app/docker/bin/rails_start.sh ports: - 3000:3000 volumes: - .:/app environment: - DB_USERNAME=root - DB_PASSWORD=root - DB_HOST=mysql - DOCKER_HOST=0.0.0.0 depends_on: - mysql - redis - mongodb - dynamodb 3BJMTͷىಈ
  10. $JSDMF$*7͔ΒEPDLFS͕

  11. ศརʹͳΓ·ͨ͠ΑͶ

  12. ͋Εʁࠓ೔ͷ͓୊͸ d34QFDςετʹ͍ͭͯd Ͱ͸ʁ

  13. ҆৺͍ͯͩ͘͠͞ɻ ࠷ޙʹग़͖ͯ·͢ɻ

  14. EPDLFSDPNQPTF $JSDMF$*ʜ ͦ͜Ͱࢥͬͨ

  15. ͜ͷϩʔΧϧ։ൃ؀ڥͷ EPDLFSDPNQPTFZNMΛ $JSDMF$*্Ͱ࢖͑ͨΒ

  16. ςετ؀ڥΛҙࣝ͠ͳͯ͘ Α͘ͳΔͷͰ

  17. %9ͷվળʹͳΔͷͰ͸ʁ

  18. None
  19. - run: name: Install Docker Compose command: | curl -L

    https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose chmod +x ~/docker-compose sudo mv ~/docker-compose /usr/local/bin/docker-compose EPDLFSDPNQPTFΛΠϯετʔϧ
  20. - run: name: docker-compose up command: | set -x docker-compose

    up --build -d EPDLFSDPNQPTFVQ
  21. - run: name: docker-compose stop command: | set -x docker-compose

    stop EPDLFSDPNQPTFTUPQ
  22. - run: name: docker-compose up command: | set -x docker-compose

    up --build -d EPDLFSDPNQPTFVQ
  23. - run: name: test command: | mkdir /tmp/test-results TEST_FILES="$(circleci tests

    glob 'spec/**/*_spec.rb' | circleci tests split --split-by=timings)" docker-compose exec rails_api bin/rspec --format progress \ --format RspecJunitFormatter \ --out /tmp/test-results/rspec.xml \ $TEST_FILES ΍ͬͱͰ͖ͯͨ3TQFD
  24. w IUUQTHJUIVCDPNXBMLFSTVNJEBSBJMTBQJGPSOVYUKTQVMM αϯϓϧ͸ͪ͜Β

  25. Ҏ্ɺ34QFDςετʹ͍ͭͯɺͰͨ͠ʂ ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ