LoginSignup
6
4

More than 5 years have passed since last update.

docker-composeでPHP5.4〜PHP7.0まで単体テストする

Last updated at Posted at 2016-07-21

次のようなYAMLを書いて、docker-compose upするだけ!

docker-compose.yml
version: "2"
services:
  php70:
    image: php:7.0-alpine
    command: vendor/bin/phpunit
    volumes: [".:/app"]
    working_dir: /app

  php56:
    image: php:5.6-alpine
    command: vendor/bin/phpunit
    volumes: [".:/app"]
    working_dir: /app

  php55:
    image: php:5.5-alpine
    command: vendor/bin/phpunit
    volumes: [".:/app"]
    working_dir: /app

  php54:
    image: php:5.4-cli
    command: vendor/bin/phpunit
    volumes: [".:/app"]
    working_dir: /app

zsh 2016-07-21 22-27-49.png

平行して実行されたくない場合は、Makefileを作っておくといい。

test:
    docker-compose up php54
    docker-compose up php55
    docker-compose up php56
    docker-compose up php70
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4