Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create self contained binary of Existing Laravel app #720

Closed
skmirajbn opened this issue Apr 13, 2024 · 5 comments
Closed

Unable to create self contained binary of Existing Laravel app #720

skmirajbn opened this issue Apr 13, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@skmirajbn
Copy link

What happened?

I followed this instructions to create self-contained binary using Frankenphp with the help of docker but got this error

image

I can't understand why this error happened. I used VirtualBox with ubuntu Linux.

Can you provide me with any solution?

Build Type

Official static build

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

Used docker static-build.Dockerfile

FROM --platform=linux/amd64 dunglas/frankenphp:static-builder

# Copy your app
WORKDIR /go/src/app/dist/app
COPY . .

# Build the static binary, be sure to select only the PHP extensions you want
WORKDIR /go/src/app/
RUN EMBED=dist/app/ \
    PHP_EXTENSIONS=ctype,iconv,pdo_sqlite \
    ./build-static.sh

Relevant log output

skmiraj@skmiraj-VirtualBox:/media/sf_shared/medispa$ docker build -t static-app -f static-build.Dockerfile .

ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied

skmiraj@skmiraj-VirtualBox:/media/sf_shared/medispa$ sudo docker build -t static-app -f static-build.Dockerfile .

[sudo] password for skmiraj: 

[+] Building 3683.7s (9/9) FINISHED                              docker:default

 => [internal] load build definition from static-build.Dockerfile          0.5s

 => => transferring dockerfile: 321B                                       0.3s

 => [internal] load metadata for docker.io/dunglas/frankenphp:static-buil  5.6s

 => [internal] load .dockerignore                                          0.3s

 => => transferring context: 2B                                            0.2s

 => [1/5] FROM docker.io/dunglas/frankenphp:static-builder@sha256:c33c  3647.3s

 => => resolve docker.io/dunglas/frankenphp:static-builder@sha256:c33c904  0.1s

 => => sha256:c33c904ca66de0247175d2be03cc44cc2413239187c 1.61kB / 1.61kB  0.0s

 => => sha256:6d9df687f31669e55137a472a77a2813b0057c40357 3.53kB / 3.53kB  0.0s

 => => sha256:497a9166924b9f2bf76b31e78f0164f4805eb30a4bc 8.61kB / 8.61kB  0.0s

 => => sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915 3.41MB / 3.41MB  13.4s

 => => sha256:e2ea43e27ed41e1206b44111529bbd2180c95be 284.21kB / 284.21kB  2.8s

 => => sha256:5d1e5825012b784ff593fd0228ab9e51a1debc7 69.33MB / 69.33MB  245.0s

 => => sha256:bd8a78f8bd685408ba9b4d847264a91faa56538105123d5 174B / 174B  3.6s

 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d 32B / 32B  4.3s

 => => sha256:990024d4c849842f61ce183a596d0c3a5fc74 129.13MB / 129.13MB  426.8s

 => => extracting sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92  2.5s

 => => sha256:01c2ec917a220502f9ae30e957e4b95af9c3c5b616e1a1 139B / 139B  14.4s

 => => sha256:d606832566c93530318c2b78b923287d40b5f30074 2.19kB / 2.19kB  17.7s

 => => extracting sha256:e2ea43e27ed41e1206b44111529bbd2180c95be99b3c66a7  0.7s

 => => sha256:d0f5f7d252cdb38dc81a9a47f8b340ddc656ece 38.11MB / 38.11MB  152.8s

 => => sha256:7892b63c8f4c59ec7071f98fa5f2c641f77db2fba8d65 155B / 155B  156.9s

 => => sha256:48d9456b8e8ce9019ce5d96ab3e8be53a97b241 31.93kB / 31.93kB  158.5s

 => => sha256:7fcec269c1874f26737f26290ef4a8cdb3ea 548.21MB / 548.21MB  1416.7s

 => => sha256:77c6124fe16b5419d671dbc5df7a1265cce8471 33.94kB / 33.94kB  247.1s

 => => extracting sha256:5d1e5825012b784ff593fd0228ab9e51a1debc731844bc  111.5s

 => => sha256:560f3378eb16f13d1f2c2dacb94605736832621 42.58kB / 42.58kB  248.6s

 => => sha256:d1191ba68633578a9d2a535b82b735701e6ab73af 5.29kB / 5.29kB  250.0s

 => => sha256:d79c3a8c3a114213155341a43e27c1a8b8072b99 1.73GB / 1.73GB  2695.0s

 => => extracting sha256:bd8a78f8bd685408ba9b4d847264a91faa56538105123d56  0.0s

 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6  0.0s

 => => extracting sha256:990024d4c849842f61ce183a596d0c3a5fc745345b0b22  132.6s

 => => extracting sha256:01c2ec917a220502f9ae30e957e4b95af9c3c5b616e1a1f7  0.0s

 => => extracting sha256:d606832566c93530318c2b78b923287d40b5f3007493ef12  0.0s

 => => extracting sha256:d0f5f7d252cdb38dc81a9a47f8b340ddc656ece6c09ab74  30.1s

 => => extracting sha256:7892b63c8f4c59ec7071f98fa5f2c641f77db2fba8d657f4  0.0s

 => => extracting sha256:48d9456b8e8ce9019ce5d96ab3e8be53a97b24146bfd1e05  0.0s

 => => extracting sha256:7fcec269c1874f26737f26290ef4a8cdb3ea4fd2dab0be  333.9s

 => => extracting sha256:77c6124fe16b5419d671dbc5df7a1265cce8471e7d39361f  0.0s

 => => extracting sha256:560f3378eb16f13d1f2c2dacb946057368326210710eca67  0.0s

 => => extracting sha256:d1191ba68633578a9d2a535b82b735701e6ab73af5262205  0.0s

 => => extracting sha256:d79c3a8c3a114213155341a43e27c1a8b8072b99e4e919  949.1s

 => [internal] load build context                                       2252.1s

 => => transferring context: 362.02MB                                   2251.4s

 => [2/5] WORKDIR /go/src/app/dist/app                                     5.0s

 => [3/5] COPY . .                                                        21.8s

 => [4/5] WORKDIR /go/src/app/                                             0.3s

 => ERROR [5/5] RUN EMBED=dist/app/     ./build-static.sh                  2.3s

------

 > [5/5] RUN EMBED=dist/app/     ./build-static.sh:

1.730 fatal: not a git repository (or any of the parent directories): .git

------

static-build.Dockerfile:9

--------------------

   8 |     WORKDIR /go/src/app/

   9 | >>> RUN EMBED=dist/app/ \

  10 | >>>     ./build-static.sh

--------------------

ERROR: failed to solve: process "/bin/ash -eo pipefail -c EMBED=dist/app/     ./build-static.sh" did not complete successfully: exit code: 128
@skmirajbn skmirajbn added the bug Something isn't working label Apr 13, 2024
@dunglas
Copy link
Owner

dunglas commented Apr 13, 2024

This looks like a duplicate of #680

@skmirajbn
Copy link
Author

This looks like a duplicate of #680

Thanks a lot. Yes, it is a duplicate. Thank you for your reply.

@skmirajbn
Copy link
Author

Hey, I successfully created the binary. But getting issue while running it.

This is my terminal log

skmiraj@skmiraj-VirtualBox:~/Desktop/Binary$ sudo ./my-app php-server public/index.php --domain localhost

2024/04/13 20:10:12.166 WARN admin admin endpoint disabled

2024/04/13 20:10:12.167 INFO http.auto_https server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "php", "https_port": 443}

2024/04/13 20:10:12.167 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "php"}

2024/04/13 20:10:12.175 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0003c1580"}

2024/04/13 20:10:12.376 INFO pki.ca.local root certificate is already trusted by system {"path": "storage:pki/authorities/local/root.crt"}

2024/04/13 20:10:12.377 INFO http enabling HTTP/3 listener {"addr": ":443"}

2024/04/13 20:10:12.378 INFO http.log server running {"name": "php", "protocols": ["h1", "h2", "h3"]}

2024/04/13 20:10:12.378 INFO http.log server running {"name": "remaining_auto_https_redirects", "protocols": ["h1", "h2", "h3"]}

2024/04/13 20:10:12.378 INFO http enabling automatic TLS certificate management {"domains": ["localhost"]}

2024/04/13 20:10:12.379 WARN tls stapling OCSP {"error": "no OCSP stapling for [localhost]: no OCSP server specified in certificate", "identifiers": ["localhost"]}

2024/04/13 20:10:12.379 INFO FrankenPHP started 🐘 {"php_version": "8.3.6"}

2024/04/13 20:10:12.389 INFO Caddy serving PHP app on :443

2024/04/13 20:10:12.413 WARN tls storage cleaning happened too recently; skipping for now {"storage": "FileStorage:/root/.local/share/caddy", "instance": "497a5137-3bb8-4f23-acee-29d5c4261586", "try_again": "2024/04/14 20:10:12.413", "try_again_in": 86399.99999929}

2024/04/13 20:10:12.428 INFO tls finished cleaning storage units

When I visit Localhost , nothing found

This localhost page can’t be foundNo webpage was found for the web address: https://localhost/
HTTP ERROR 404

Can you tell me why?

@skmirajbn
Copy link
Author

Is there any way to choose the PHP version while creating a self-contained binary?

@dunglas
Copy link
Owner

dunglas commented Apr 14, 2024

@skmirajbn Yes, use the PHP_VERSION environnement variable: https://frankenphp.dev/docs/static/#customizing-the-build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants