douhan1860 2018-03-07 06:58
浏览 497
已采纳

为什么我的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 2018-03-07 07:04
    关注

    At first glance,

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog