docker-php-tutorial icon indicating copy to clipboard operation
docker-php-tutorial copied to clipboard

failed to download laravel/laravel from dist

Open firecentaur opened this issue 2 years ago • 2 comments

Hi there, I am following your Run Laravel 9 on Docker in 20224.3 tutorial and am on the install laravel step however,

when I run the command:

make execute-in-container DOCKER_SERVICE_NAME="application" COMMAND='composer create-project --prefer-dist laravel/laravel /tmp/laravel "9.*" --no-install --no-scripts'

I get the following error:

ENV=local TAG=latest DOCKER_REGISTRY=docker.io DOCKER_NAMESPACE=dofroscra APP_USER_NAME=application APP_GROUP_NAME=application docker-compose -p dofroscra_local --env-file ./.docker/.env -f ./.docker/docker-compose/docker-compose.yml -f ./.docker/docker-compose/docker-compose.local.yml exec -T --user application application composer create-project --prefer-dist laravel/laravel /tmp/laravel "9.*" --no-install --no-scripts
Creating a "laravel/laravel" project at "/tmp/laravel"
Info from https://repo.packagist.org: #StandWithUkraine
Installing laravel/laravel (v9.1.10)
    Failed to download laravel/laravel from dist: /var/www/app/vendor/composer does not exist and could not be created.
    Now trying to download from source

                                                            
  [RuntimeException]                                        
  git was not found in your PATH, skipping source download  


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package>] [<directory>] [<version>]

make: *** [.make/01-01-application-commands.mk:24: execute-in-container] Error 

I have already run make docker-build, and make docker-up. What am I doing wrong?
(Running PopOS 22.04)

firecentaur avatar Jun 27 '22 17:06 firecentaur

hello?

firecentaur avatar Jun 28 '22 21:06 firecentaur

Hey @firecentaur,

which branch are you using? When you want to "install laravel yourself" you need to use part-4-2-phpstorm-docker-xdebug-3-php-8-1-in-2022. Branch part-4-3-run-laravel-9-docker-in-2022 contains the "final result" with Laravel already installed.

Seems like git is not properly installed in the image. You might have a stale image, so you could try to run

ENV=local TAG=latest DOCKER_REGISTRY=docker.io DOCKER_NAMESPACE=dofroscra APP_USER_NAME=application APP_GROUP_NAME=application docker-compose -p dofroscra_local --env-file ./.docker/.env -f ./.docker/docker-compose/docker-compose-php-base.yml build php-base --no-cache

once before make docker-build to ensure that you don't use any chached versions.


I just tried the following steps and they work out as expected for me:

git checkout part-4-2-phpstorm-docker-xdebug-3-php-8-1-in-2022

Add to .docker/images/php/base/Dockerfile (final file: https://github.com/paslandau/docker-php-tutorial/blob/part-4-3-run-laravel-9-docker-in-2022/.docker/images/php/base/Dockerfile )

# ...

RUN apk add --update --no-cache  \
        php-curl~=${TARGET_PHP_VERSION}
make make-init

make docker-build

make docker-up

make execute-in-container DOCKER_SERVICE_NAME="application" COMMAND='composer create-project --prefer-dist laravel/laravel /tmp/laravel "9.0.*" --no-install --no-scripts'

rm -rf public/ tests/ composer.* phpunit.xml
make execute-in-container DOCKER_SERVICE_NAME="application" COMMAND="bash -c 'mv -n /tmp/laravel/{.*,*} .' && rm -f /tmp/laravel"
cp .env.example .env

make composer ARGS=install
make composer ARGS="run-script post-create-project-cmd"

paslandau avatar Jun 29 '22 06:06 paslandau