docker icon indicating copy to clipboard operation
docker copied to clipboard

/vendor/bin folder has empty files after running "composer install"

Open tusamni opened this issue 5 years ago • 10 comments

I'm trying to install Statamic on a docker-compose setup.

When I run "composer install" on XAMPP, I end up with a /vendor/bin folder that looks like this:

Screenshot_1

When I run the same command through my Docker setup, I get similar files, however, they're all 0 bytes and can't be opened.

Screenshot_2

My docker-compose.yaml file looks like this:

`version: '3'

networks:
  statamic:

services:
  site:
    image: nginx:stable-alpine
    container_name: nginx
    ports:
      - "8080:80"
    volumes:
      - ./src:/var/www/html
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
      - mysql
    networks:
      - statamic

  mysql:
    image: mysql:5.7.29
    container_name: mysql
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: homestead
      MYSQL_USER: homestead
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    networks:
      - statamic

  php:
    build:
      context: .
      dockerfile: php.dockerfile
    container_name: php
    volumes:
      - ./src:/var/www/html
    ports:
      - "9000:9000"
    networks:
      - statamic

  composer:
    image: composer:latest
    container_name: composer
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html
    depends_on:
      - php
    networks:
      - statamic

  npm:
    image: node:13.7
    container_name: npm
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html
    entrypoint: ['npm']

  artisan:
    build:
      context: .
      dockerfile: php.dockerfile
    container_name: artisan
    volumes:
      - ./src:/var/www/html
    depends_on:
      - mysql
    working_dir: /var/www/html
    entrypoint: ['php', '/var/www/html/artisan']
    networks:
      - statamic`

tusamni avatar Jul 29 '20 16:07 tusamni

After reading the Composer official docs I guess on UNIX systems the vendor/bin directory will contain symlinks. That must be what those files are.

tusamni avatar Jul 29 '20 16:07 tusamni

The issue then becomes when I try to startup my site: "docker-compose -d --build" I get the following error:

Screenshot_1

tusamni avatar Jul 29 '20 16:07 tusamni

The error in the last screenshot is from npm by the look of it. The files in vendor/bin are symlinks and should be callable even on windows

exussum12 avatar Aug 03 '20 19:08 exussum12

I have the same issue, does one know a fix?

pandarhys avatar Dec 29 '20 16:12 pandarhys

have you got a repeatable case ? Could you upload the docker file for example ?

exussum12 avatar Dec 29 '20 17:12 exussum12

have you got a repeatable case ? Could you upload the docker file for example ?

Hi, I working through an online tutorial, after I install laravel and then install composer the files are all 0 which I think is symlink?

But when I run up -d --build I get the following issue

image

my docker file and env

docker-compose.zip

pandarhys avatar Dec 29 '20 18:12 pandarhys

Thats in the node one ? The docker compose file doesnt seen to have valid stuff in either, can you link the whole tutoral ?

This doesnt seem to be a composer issue though

exussum12 avatar Dec 29 '20 22:12 exussum12

Thats in the node one ? The docker compose file doesnt seen to have valid stuff in either, can you link the whole tutoral ?

This doesnt seem to be a composer issue though

Hi, I can't share as its a paid tutorial. I seem to have got this working on another project I was working on, I'm wondering if its installing the wrong dependencies. I've read about the package.lock file being wrong.

pandarhys avatar Dec 30 '20 17:12 pandarhys

Possibly, that error is about node_modules not composer. If its paid, I would ask the author whats going wrong.

This is not a composer issue though

exussum12 avatar Dec 30 '20 20:12 exussum12

I have the same problem in the project without node_modules - it happens with vendor/bin contents as stated in the original post. There are empty files with restricted permissions, so docker up can't handle with it and can't build. If I delete those files manually, everything is ok.

mikitachu avatar Mar 01 '21 16:03 mikitachu

@Seldaek I suggest closing this issue given that Composer does not generate symlinks anymore.

stof avatar May 24 '23 13:05 stof

We still have symlinks for path repos, but yeah bin files are solved, I guess we can close here anyway as there isn't really anything actionable.

Seldaek avatar May 24 '23 13:05 Seldaek