Laravel的composer.lock文件未在docker/ docker-compose上更新

0md85ypi  于 2022-12-24  发布在  Docker
关注(0)|答案(1)|浏览(165)

我正在做一个Laravel项目。我使用docer-compose/docker作为我的开发环境。
这是我的docker-compose. yml文件。

version: '3'
services:
  apache:
    container_name: myaneat_apache
    image: webdevops/apache:ubuntu-16.04
    environment:
      WEB_DOCUMENT_ROOT: /var/www/public
      WEB_ALIAS_DOMAIN: myan.localhost
      WEB_PHP_SOCKET: php-fpm:9000
    volumes: # Only shared dirs to apache (to be served)
      - ./public:/var/www/public:cached
      - ./storage:/var/www/storage:cached
    networks:
      - myaneat-network
    ports:
      - "80:80"
      - "443:443"
  php-fpm:
    container_name: myaneat_php
    image: jguyomard/laravel-php:7.3
    volumes:
      - ./:/var/www/
      - ./ci:/var/www/ci:cached
      - ./vendor:/var/www/vendor:delegated
      - ./storage:/var/www/storage:delegated
      - ./node_modules:/var/www/node_modules:cached
      - ~/.ssh:/root/.ssh:cached
      - ./composer.json:/var/www/composer.json
      - ./composer.json:/var/www/composer.lock
      - ~/.composer/cache:/root/.composer/cache:delegated
    networks:
      - myaneat-network
  db:
    container_name: myaneat_db
    image: mariadb:10.2
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: myan
      MYSQL_USER: myan
      MYSQL_PASSWORD: secret
    volumes:
      - myaneat-data:/var/lib/mysql
    networks:
      - myaneat-network
    ports:
      - "33060:3306"
  elasticsearch:
    container_name: myaneat_es
    image: docker.elastic.co/elasticsearch/elasticsearch:6.5.1
    restart: always
    volumes:
      - es-data:/usr/share/elasticsearch/data
    networks:
      - myaneat-network
    ports:
      - "9200:9200"
  kibana:
    image: docker.elastic.co/kibana/kibana:6.5.1
    container_name: myaneat_kibana
    environment:
      - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    ports:
      - "5601:5601"
    networks:
      - myaneat-network
networks:
  myaneat-network:
    driver: "bridge"
volumes:
  myaneat-data:
    driver: "local"
  es-data:
    driver: "local"

我正在运行以下命令安装一个新的软件包。

docker-compose exec php-fpm composer require calebporzio/sushi

但是只有composer.json更新了,composer.lock没有更新。而且,包也没有下载到vendor文件夹中。我之前在工作。只是突然发生了这种情况。
我尝试了以下方法:

docker-compose exec php-fpm composer clearcache
docker-compose exec php-fpm composer clear-cache
docker-compose exec php-fpm composer dump-autoload
docker-compose exec php-fpm composer update --lock

可能的根本原因是什么?我如何修复它?

6vl6ewon

6vl6ewon1#

您可以尝试运行特定于锁的更新:

docker-compose exec php-fpm composer update --lock

此标志记录在here
至于.lock文件的更新,你可以找到关于它的信息here,你在最后一句感兴趣。
运行编写器更新将:
1.检查合成器. json
1.根据版本规范确定要安装的最新版本
1.安装最新版本
1.更新composer.lock以反映安装的最新版本

相关问题