Saturday 13 May 2017

How to use php & nodejs from separate containers

Let's say I have the following situation:

docker-compose.yml

version: '3'
services:
    web:
        build: .
        links:
            - apache
            - php
            - node
        depends_on:
            - apache
            - php
            - node
        volumes:
            - .:/var/www/html
    apache:
        image: httpd
    php:
        image: php
    node:
        image: node

and I also have a Dockerfile

FROM phusion/baseimage
RUN apt-get update
RUN apt-get install -yq git curl zip wget curl
RUN curl -s https://getcomposer.org/installer | php # error, no PHP exec found
RUN mv composer.phar /usr/local/bin/composer
RUN npm install -g bower gulp
COPY ./ /var/www/html
WORKDIR /var/www/html
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD ["/sbin/my_init"]

Now my question is: how could I use PHP & Node, which are installed in separate containers, in this main app Dockerfile? Is that even possible, or do I need to manually install PHP & Node inside my Dockerfile?



via Borut

No comments:

Post a Comment