我正在尝试将Laravel应用程序 docker 化。
这是我的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
我不明白为什么它不执行所有的作曲和弦乐指令
最佳答案
乍一看,# This loads nvm \
将注释掉\
,因此后续的cmds将不会运行。