:ドッカー-コン:設定私は、次の<em>ドッキングウィンドウ-compose.yml</em>を持つPHPアプリケーションのビルド順序
私Dockerfileでもversion:'2'
services:
service:
build:
context: .
dockerfile: Dockerfile
image: "service"
service_debug:
build:
context: .
dockerfile: Dockerfile_debug
image: "service_debug"
ports:
- "9001:9001"
私が持っている次のコンテキスト
FROM php:7.0-fpm-alpine
MAINTAINER Monkey D. Luffy
EXPOSE 9000
VOLUME /var/www/html
#Do build stuff
#....
私はxockbugをインストールするところの上のdockerfileでビルドしたドッカーイメージのベースとなる別のドッカーファイルも持っています。このファイルの名前は(docker-compose.yml
)Dockerfile_debug
です。この画像は、(私の場合はXdebugに例えば、それは、任意のツールや設定することができます)いくつかのデバッグのツールが含まれます:
FROM service
MAINTAINER Kurosaki Ichigo
EXPOSE 9001
EXPOSE 9000
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
RUN sed -i '1 a xdebug.remote_autostart=true' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_mode=req' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_handler=dbgp' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_connect_back=1 ' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_port=9001' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_host=127.0.0.1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN sed -i '1 a xdebug.remote_enable=1' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
私は2つのサービスとどのように間のビルド順序を設定する方法docker-compose build
を実行したときに私の質問です私が作成した画像をservice_debug
からservice
の最新画像に基づいて作成します。
他の言い方をすれば、私のアプリケーションが生産準備完了ドッカー画像で動作するかどうかをテストできるように、生産準備完了イメージとデバッグイメージを同時に生成したいと考えています。