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 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作