-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
FrankenPHP do no build binary with embed php app #748
Comments
Hello @grandrr! Instead of
Can you instead run the EMBED command first, like this:
I'm working on a Dockerfile generator for Laravel apps( fly-apps/dockerfile-laravel ) And I've recently added support to generate a Dockerfile that uses FrankenPHP to build a standalone binary( and get it deployable at Fly.io )! In my journey I've also experienced a similar misconception about running EMBED incorrectly as I've mentioned in a post. See items under ( NOTE! ). I think that running EMBED first before declaring FRANKENPHP_VERSION should proceed with proper binary generation. ( although it took some time for the build to finish ). And once the build finishes, and you run
That should be your sign that the app has been embedded successfully! |
Thanks KTanAug21, i will try! |
Thanks one more time! its working! i got this log: |
What happened?
So i had try build binary with embed php app, build finish successfully but binary do not include embed php app, or i dont know how to build/use it.
When i had try use dockerfile as described here:
https://frankenphp.dev/docs/embed/#creating-a-linux-binary
I got error that this is not git folder, after some digging in issues described here i realise that i should add this line:
FRANKENPHP_VERSION=1.1.2
as result my Dockerfile starting looks like:
So I had try build container by command:
docker build -t static-app -f static-build.Dockerfile .
This time its build successfully.
After i had try run command for build binary its stuck for some reason. So i remove all section related to run command for build binary, Dockerfile start looks like:
I had build one more time, go inside container and run command inside container.
Run container by command:
docker run -it -p 127.0.0.1:80:80 static-app
after i get inside container in to folder:
/go/src/app
as described in DockerfileAnd in this folder i run command for build binary like this:
FRANKENPHP_VERSION=1.1.2 EMBED=dist/app/ PHP_EXTENSIONS=ctype,iconv,pdo_sqlite ./build-static.sh
As result i get binary file, so i had run it like this:
./dist/frankenphp-linux-x86_64 php-server -v
its executed fine, but after i had try hit in browser:
http://127.0.0.1/
I got no response, and logs like this:
So i had try run this one:
http://127.0.0.1/index.php
and got response in browser:
So this is mean its looking for files in same root as binary is located, so as there is index.php copied from my local machine by command in Dockerfile i had try run it by url:
http://127.0.0.1/dist/app/index.php
and got response from my php file.
and my project:
![Screenshot 2024-04-25 at 19 57 16](https://private-user-images.githubusercontent.com/1290709/325720360-1c1fb858-87f3-4842-9b2c-ff01a93b4233.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0NDM3OTAsIm5iZiI6MTcyMTQ0MzQ5MCwicGF0aCI6Ii8xMjkwNzA5LzMyNTcyMDM2MC0xYzFmYjg1OC04N2YzLTQ4NDItOWIyYy1mZjAxYTkzYjQyMzMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjBUMDI0NDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWY3NmJlOTYxNmRjNWJiMDQxMDYwZjNlMDA0MjEzNzU0ZWI2MTEzZjc0YWIzMmRiYjllMWQ5ODM4YzE1YTUxZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.rUbs4uCgIbAQQ75QxDEZM51uta9CrMIJKjwzucAXpTU)
Build Type
Docker (Debian Bookworm)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Relevant log output
No response
The text was updated successfully, but these errors were encountered: