dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.7k stars 220 forks source link

CANCELED [frankenphp internal] load build context #731

Closed gmalanchuk closed 2 months ago

gmalanchuk commented 5 months ago

Why is this happening? I'm doing everything exactly according to the documentation. Maybe the problem is that I'm using wsl?

error image

grigory@DESKTOP-NOCEPT4:/mnt/d/projects/test$ docker-compose up --build
WARN[0000] /mnt/d/projects/test/docker-compose.yml: `version` is obsolete 
[+] Building 4.2s (6/7)                                                                                                                                              docker:default
 => [frankenphp internal] load build definition from Dockerfile                                                                                                                0.1s
 => => transferring dockerfile: 207B                                                                                                                                           0.1s 
 => [frankenphp internal] load metadata for docker.io/dunglas/frankenphp:latest                                                                                                0.9s 
 => [frankenphp internal] load .dockerignore                                                                                                                                   0.1s
 => => transferring context: 2B                                                                                                                                                0.1s 
 => CACHED [frankenphp 1/3] FROM docker.io/dunglas/frankenphp:latest@sha256:c167308ddec4c1b29ba1a4d38adca95c265723ee1983a86b8077d441648d04de                                   0.0s 
 => => resolve docker.io/dunglas/frankenphp:latest@sha256:c167308ddec4c1b29ba1a4d38adca95c265723ee1983a86b8077d441648d04de                                                     0.0s 
 => CANCELED [frankenphp internal] load build context                                                                                                                          2.3s 
 => => transferring context: 11.71MB                                                                                                                                           2.3s
 => CANCELED [frankenphp 2/3] RUN install-php-extensions     pcntl                                                                                                             3.0s 
failed to solve: error from sender: context canceled

docker-compose

version: '3.8'

services:
    frankenphp:
        build: .
        entrypoint: php artisan octane:frankenphp --max-requests=1
        ports:
            - "8000:8000"
        volumes:
            - .:/app

    mysql:
        image: mysql:8.3
        restart: always
        environment:
            - MYSQL_DATABASE=laravel
            - MYSQL_ROOT_PASSWORD=laravel
        ports:
            - '3306:3306'
        volumes:
            - mysql_data:/var/lib/mysql

    adminer:
        image: adminer:4.8.1
        restart: always
        ports:
            - '8080:8080'
        depends_on:
            - mysql

volumes:
    mysql_data:

Dockerfile

FROM dunglas/frankenphp

RUN install-php-extensions \
    pcntl
    # Add other PHP extensions here...

COPY . /app

ENTRYPOINT ["php", "artisan", "octane:frankenphp"]
dunglas commented 5 months ago

This looks like a potential network error. Double-check that your connection is OK and that no firewall (or similar network tool) block the connection.

gmalanchuk commented 5 months ago

Other applications build fine in docker, it is the dunglas/frankenphp container that causes the problem. I don't know how to explain it🤷

dunglas commented 5 months ago

Can you try to run docker compose build --progress plain --no-cache and copy the full output please?

AlliBalliBaba commented 2 months ago

I don't think this is a FrankenPHP issue. The problem here comes from copying the project folder into the app COPY . /app and at the same time mounting the project folder into the same directory volumes: - .:/app. This can lead to weird behaviour. The docker image should build fine if the COPY . /app line is removed:

dunglas commented 2 months ago

Closing for now then.