dockernginxgulpdocker-composedockerfile

How to run two commands on Dockerfile?


I have to execute two commands on the docker file, but both these commands are attached to the terminal and block the execution from the next.

dockerfile:

FROM sinet/nginx-node:latest

RUN mkdir /usr/src/app

WORKDIR /usr/src/app

RUN git clone https://name:pass@bitbucket.org/joaocromg/front-web-alferes.git
WORKDIR /usr/src/app/front-web-alferes

RUN npm install 
    
RUN npm install bower -g 
RUN npm install gulp -g 
RUN bower install --allow-root 
    
COPY default.conf /etc/nginx/conf.d/

RUN nginx -g 'daemon off;' & # command 1 blocking
 
CMD ["gulp watch-dev"] # command 2 not executed

Someone know how can I solve this?


Solution

  • I suggest you try supervisord in this case. http://supervisord.org/

    Edit: Here is an dockerized example of httpd and ssh daemon: https://riptutorial.com/docker/example/14132/dockerfile-plus-supervisord-conf