Ankita Chandel
Ankita Chandel

Reputation: 1

How to write commands with multiple lines in Dockerfile

This command does not run correctly. give error to execute them

How to write commands with multiple lines in Dockerfile

RUN echo <VirtualHost *> >>  phabricator.conf && \
    echo <Directory "/var/www/html/repository/phabricator/webroot/">' >> phabricator.conf && \
    echo Options All Indexes FollowSymLinks' >>phabricator.conf && \
    echo Order allow,deny' >> phabricator.conf && \
    echo Allow from all' >> phabricator.conf && \
    echo Require all granted' >> phabricator.conf && \
    echo </Directory>' >> phabricator.conf && \
    echo ServerName localhost' >> phabricator.conf && \
    echo DocumentRoot /var/www/html/repository/phabricator/webroot' >> phabricator.conf && \
    echo  >> phabricator.conf && \
    echo RewriteEngine on' >>  phabricator.conf && \
    echo RewriteRule ^/rsrc/(.*)-[L,QSA]  >>  phabricator.conf && \
    echo RewriteRule ^/favicon.ico -[L,QSA]   >>  phabricator.conf && \
    echo RewriteRule ^(.*)$   /index.php?__path__=$1  [B,L,QSA] >>  phabricator.conf && \
    echo '</VirtualHost>' >> phabricator.conf && \
    echo '' >> phabricator.conf && \

Upvotes: 0

Views: 311

Answers (1)

DannyB
DannyB

Reputation: 14776

  1. The last line should not end with && \ - not sure if it is the problem but it sure is a problem.
  2. This is a terrible practice. As you can already see, its hard to debug. Create your files normally, and just COPY them to the image instead of creating them with an awkward chain of shell commands.

Upvotes: 3

Related Questions