douhan1860
douhan1860
2018-03-07 06:58
浏览 423

为什么我的Dockerfile没有执行命令

I'm trying to dockerise my Laravel app.

Here is my dockerfile:

FROM php:7.1.14-fpm

WORKDIR /app
COPY . /app
COPY ./entrypoint.sh /tmp

RUN touch /app/resources/assets/less/_main_full/main.less \
&& touch /app/database.sqlite \
&& apt-get update -y && apt-get install -y openssl zip unzip git npm \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libmcrypt-dev \
    libpng12-dev \
    libmagickwand-dev --no-install-recommends \
    sqlite3 libsqlite3-dev \
&& apt-get purge --auto-remove -y g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install pdo pdo_mysql mbstring zip -j$(nproc) iconv mcrypt -j$(nproc) gd \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm \
&& nvm install node \
&& npm cache clean -f && npm install -g n && n stable && npm install cross-env && npm install && npm run dev \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --no-interaction \
&& chown -R www-data:www-data \
        /app/storage \
        /app/bootstrap/cache \
&&  chmod 755 /tmp/entrypoint.sh

CMD ["/tmp/entrypoint.sh"]

When I build it with:

docker build -f laravel-local.dockerfile . --no-cache

I get this output:

...
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
Removing intermediate container 642a7d7f4a59
 ---> 5121a6997e87
Step 6/6 : CMD ["/tmp/entrypoint.sh"]
 ---> Running in 7f7468684e00
Removing intermediate container 7f7468684e00
 ---> df2ee7652870
Successfully built df2ee7652870

I don't understand why isn't it executing all the composer and chown instructions

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzheng4556
    dongzheng4556 2018-03-07 07:04
    已采纳

    At first glance,

    # This loads nvm \ will comment out \ so the subsequent cmds wont run.

    点赞 评论

相关推荐