COMPOSER.json установить с помощью dockerfile - PullRequest
0 голосов
/ 17 октября 2018

ОШИБКА: не удалось создать службу 'api': сбой копирования: stat /var/lib/docker/tmp/docker-builder719265864/composer.json: такого файла или каталога нет

Docker-compose.yml

volumes:
    - .:/var/www
    - .:/var/www/vendor/

Dockerfile

# Install composer
WORKDIR /var/www/

RUN apt-get update && \
        apt-get install -y --no-install-recommends git zip

RUN curl --silent --show-error https://getcomposer.org/installer | php

COPY ./ /var/www/

RUN php composer.phar install

Мой composer.json находится в / src в моей папке.

"require": {
    "php": ">=5.6",
    "slim/slim": "^3.11",
    "slim/php-view": "^2.0",
    "monolog/monolog": "^1.17"
},

Я хочу запустить свойcomposer.json, когда я строю.

1 Ответ

0 голосов
/ 17 октября 2018
# Install composer
RUN echo pwd: `pwd` && echo ls: `ls`  # outputs:
                                      # pwd: /
                                      # ls:

#Copiando projeto para o container
COPY composer.lock /var/www/html
COPY composer.json /var/www/html
COPY logs /var/www/html/logs
COPY public /var/www/html/public
COPY src /var/www/html/src

VOLUME /var/www/html
WORKDIR /var/www/html
RUN pwd

# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1

# Setup the Composer installer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
  && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
  && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
  && php /tmp/composer-setup.php \
  && chmod a+x composer.phar \
  && mv composer.phar /usr/local/bin/composer

# Install composer dependencies
RUN echo pwd: `pwd` && echo ls: `ls`  # outputs:
                                      # pwd: /var/www/html
                                      # ls:

RUN /usr/local/bin/composer install

#RUN /usr/local/bin/composer update


# Install composer dependencies
RUN echo pwd: `pwd` && echo ls: `ls`  # outputs:
                                      # pwd: /var/www/html
                                      # ls:
...