-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from fly-apps/integ_frankenphp_single_file_binary
Support FrankenPHP to embed Laravel app into a standalone binary
- Loading branch information
Showing
9 changed files
with
109 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Builder stage to create frankenphp binary containing our embedded app | ||
FROM dunglas/frankenphp:static-builder as builder | ||
|
||
# Copy our app found in the previous "base" stage | ||
WORKDIR /go/src/app/dist/app | ||
COPY --from=base /var/www/html . | ||
|
||
# Build the static binary, be sure to select only the PHP extensions you want | ||
WORKDIR /go/src/app/ | ||
RUN EMBED=dist/app/ \ | ||
FRANKENPHP_VERSION=1.1.2 \ | ||
PHP_EXTENSIONS=bcmath,cli,common,curl,gd,intl,mbstring,mysql,pgsql,redis,soap,sqlite3,xml,zip,swoole,fpm \ | ||
./build-static.sh | ||
|
||
# Last runner stage, to only contain and run our generated binary from builder stage | ||
FROM dunglas/frankenphp AS runner | ||
|
||
# Replace the official binary by the one contained your custom modules | ||
COPY --from=builder /go/src/app/dist/frankenphp-linux-x86_64 /usr/local/bin/frankenphp | ||
|
||
# EXPOSE ports | ||
EXPOSE 8080 | ||
|
||
# Start app | ||
ENTRYPOINT ["/usr/local/bin/frankenphp", "php-server", "--listen",":8080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# If we're using Filament v3 and above, run caching commands... | ||
RUN php artisan icons:cache && php artisan filament:cache-components | ||
RUN php artisan icons:cache && php artisan filament:cache-components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Builder stage to create frankenphp binary containing our embedded app | ||
FROM dunglas/frankenphp:static-builder as builder | ||
|
||
# Copy our app found in the previous "base" stage | ||
WORKDIR /go/src/app/dist/app | ||
COPY --from=base /var/www/html . | ||
|
||
# Build the static binary, be sure to select only the PHP extensions you want | ||
WORKDIR /go/src/app/ | ||
RUN EMBED=dist/app/ \ | ||
FRANKENPHP_VERSION=1.1.2 \ | ||
PHP_EXTENSIONS=bcmath,cli,common,curl,gd,intl,mbstring,mysql,pgsql,redis,soap,sqlite3,xml,zip,swoole,fpm \ | ||
./build-static.sh | ||
|
||
# Last runner stage, to only contain and run our generated binary from builder stage | ||
FROM dunglas/frankenphp AS runner | ||
|
||
# Replace the official binary by the one contained your custom modules | ||
COPY --from=builder /go/src/app/dist/frankenphp-linux-x86_64 /usr/local/bin/frankenphp | ||
|
||
# EXPOSE ports | ||
# Start app | ||
ENTRYPOINT ["/usr/local/bin/frankenphp", "php-server", "--listen",":8080"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"require": { | ||
}, | ||
"extra":{ | ||
"flags":{ | ||
"frankenphp-binary":true | ||
}, | ||
"templates":["Dockerfile"] | ||
} | ||
} |