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

时间:2018-03-07 06:58:44

标签: php docker

我试图将我的Laravel应用程序停靠。

这是我的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"]

当我用它构建时:

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

我得到了这个输出:

...
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

我不明白为什么它没有执行所有作曲家和chown指令

1 个答案:

答案 0 :(得分:0)

乍一看,

# This loads nvm \将注释掉\,以便后续的cmds不会运行。