-
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 #29 from fly-apps/detect_octane
Detect octane availability in composer.json, flavors through binaries…
- Loading branch information
Showing
24 changed files
with
587 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[2024-04-01 17:29:21] development.ERROR: Declaration of LaravelZero\Framework\Commands\BuildCommand::handleSignal(int $signal): int|false must be compatible with Symfony\Component\Console\Command\SignalableCommandInterface::handleSignal(int $signal, int|false $previousExitCode = 0): int|false {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Declaration of LaravelZero\\Framework\\Commands\\BuildCommand::handleSignal(int $signal): int|false must be compatible with Symfony\\Component\\Console\\Command\\SignalableCommandInterface::handleSignal(int $signal, int|false $previousExitCode = 0): int|false at /home/admin_kath/development/projects/dockerfile-laravel/vendor/laravel-zero/framework/src/Commands/BuildCommand.php:84) | ||
[stacktrace] | ||
#0 {main} | ||
"} |
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,79 @@ | ||
# syntax = docker/dockerfile:experimental | ||
|
||
ARG PHP_VERSION=8.2 | ||
ARG NODE_VERSION=18 | ||
FROM fideloper/fly-laravel:${PHP_VERSION} as base | ||
|
||
# PHP_VERSION needs to be repeated here | ||
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact | ||
ARG PHP_VERSION | ||
|
||
LABEL fly_launch_runtime="laravel" | ||
|
||
# copy application code, skipping files based on .dockerignore | ||
COPY . /var/www/html | ||
|
||
RUN composer install --optimize-autoloader --no-dev \ | ||
&& mkdir -p storage/logs \ | ||
&& php artisan optimize:clear \ | ||
&& chown -R www-data:www-data /var/www/html \ | ||
&& echo "MAILTO=\"\"\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel \ | ||
&& sed -i 's/protected \$proxies/protected \$proxies = "*"/g' app/Http/Middleware/TrustProxies.php;\ | ||
if [ -d .fly ]; then cp .fly/entrypoint.sh /entrypoint; chmod +x /entrypoint; fi; | ||
|
||
RUN rm -rf /etc/supervisor/conf.d/fpm.conf; \ | ||
mv /etc/supervisor/octane-franken.conf /etc/supervisor/conf.d/octane-franken.conf; \ | ||
rm -f frankenphp; \ | ||
php artisan octane:install --no-interaction --server=frankenphp; \ | ||
rm /etc/nginx/sites-enabled/default; \ | ||
ln -sf /etc/nginx/sites-available/default-octane /etc/nginx/sites-enabled/default; | ||
|
||
# Multi-stage build: Build static assets | ||
# This allows us to not include Node within the final container | ||
FROM node:${NODE_VERSION} as node_modules_go_brrr | ||
|
||
RUN mkdir /app | ||
|
||
RUN mkdir -p /app | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=base /var/www/html/vendor /app/vendor | ||
|
||
# Use yarn or npm depending on what type of | ||
# lock file we might find. Defaults to | ||
# NPM if no lock file is found. | ||
# Note: We run "production" for Mix and "build" for Vite | ||
RUN if [ -f "vite.config.js" ]; then \ | ||
ASSET_CMD="build"; \ | ||
else \ | ||
ASSET_CMD="production"; \ | ||
fi; \ | ||
if [ -f "yarn.lock" ]; then \ | ||
yarn install --frozen-lockfile; \ | ||
yarn $ASSET_CMD; \ | ||
elif [ -f "pnpm-lock.yaml" ]; then \ | ||
corepack enable && corepack prepare pnpm@latest-8 --activate; \ | ||
pnpm install --frozen-lockfile; \ | ||
pnpm run $ASSET_CMD; \ | ||
elif [ -f "package-lock.json" ]; then \ | ||
npm ci --no-audit; \ | ||
npm run $ASSET_CMD; \ | ||
else \ | ||
npm install; \ | ||
npm run $ASSET_CMD; \ | ||
fi; | ||
|
||
# From our base container created above, we | ||
# create our final image, adding in static | ||
# assets that we generated above | ||
FROM base | ||
|
||
# Packages like Laravel Nova may have added assets to the public directory | ||
# or maybe some custom assets were added manually! Either way, we merge | ||
# in the assets we generated above rather than overwrite them | ||
COPY --from=node_modules_go_brrr /app/public /var/www/html/public-npm | ||
RUN rsync -ar /var/www/html/public-npm/ /var/www/html/public/ \ | ||
&& rm -rf /var/www/html/public-npm \ | ||
&& chown -R www-data:www-data /var/www/html/public | ||
|
||
EXPOSE 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,6 @@ | ||
{ | ||
"require": { | ||
"laravel/framework": "^10.0.0", | ||
"laravel/octane" : "*" | ||
} | ||
} |
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 @@ | ||
test |
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 @@ | ||
rryaml |
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,79 @@ | ||
# syntax = docker/dockerfile:experimental | ||
|
||
ARG PHP_VERSION=8.2 | ||
ARG NODE_VERSION=18 | ||
FROM fideloper/fly-laravel:${PHP_VERSION} as base | ||
|
||
# PHP_VERSION needs to be repeated here | ||
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact | ||
ARG PHP_VERSION | ||
|
||
LABEL fly_launch_runtime="laravel" | ||
|
||
# copy application code, skipping files based on .dockerignore | ||
COPY . /var/www/html | ||
|
||
RUN composer install --optimize-autoloader --no-dev \ | ||
&& mkdir -p storage/logs \ | ||
&& php artisan optimize:clear \ | ||
&& chown -R www-data:www-data /var/www/html \ | ||
&& echo "MAILTO=\"\"\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel \ | ||
&& sed -i 's/protected \$proxies/protected \$proxies = "*"/g' app/Http/Middleware/TrustProxies.php;\ | ||
if [ -d .fly ]; then cp .fly/entrypoint.sh /entrypoint; chmod +x /entrypoint; fi; | ||
|
||
RUN rm -rf /etc/supervisor/conf.d/fpm.conf; \ | ||
mv /etc/supervisor/octane-rr.conf /etc/supervisor/conf.d/octane-rr.conf; \ | ||
if [ -f ./vendor/bin/rr ]; then ./vendor/bin/rr get-binary; fi; \ | ||
rm -f .rr.yaml; \ | ||
rm /etc/nginx/sites-enabled/default; \ | ||
ln -sf /etc/nginx/sites-available/default-octane /etc/nginx/sites-enabled/default; | ||
|
||
# Multi-stage build: Build static assets | ||
# This allows us to not include Node within the final container | ||
FROM node:${NODE_VERSION} as node_modules_go_brrr | ||
|
||
RUN mkdir /app | ||
|
||
RUN mkdir -p /app | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=base /var/www/html/vendor /app/vendor | ||
|
||
# Use yarn or npm depending on what type of | ||
# lock file we might find. Defaults to | ||
# NPM if no lock file is found. | ||
# Note: We run "production" for Mix and "build" for Vite | ||
RUN if [ -f "vite.config.js" ]; then \ | ||
ASSET_CMD="build"; \ | ||
else \ | ||
ASSET_CMD="production"; \ | ||
fi; \ | ||
if [ -f "yarn.lock" ]; then \ | ||
yarn install --frozen-lockfile; \ | ||
yarn $ASSET_CMD; \ | ||
elif [ -f "pnpm-lock.yaml" ]; then \ | ||
corepack enable && corepack prepare pnpm@latest-8 --activate; \ | ||
pnpm install --frozen-lockfile; \ | ||
pnpm run $ASSET_CMD; \ | ||
elif [ -f "package-lock.json" ]; then \ | ||
npm ci --no-audit; \ | ||
npm run $ASSET_CMD; \ | ||
else \ | ||
npm install; \ | ||
npm run $ASSET_CMD; \ | ||
fi; | ||
|
||
# From our base container created above, we | ||
# create our final image, adding in static | ||
# assets that we generated above | ||
FROM base | ||
|
||
# Packages like Laravel Nova may have added assets to the public directory | ||
# or maybe some custom assets were added manually! Either way, we merge | ||
# in the assets we generated above rather than overwrite them | ||
COPY --from=node_modules_go_brrr /app/public /var/www/html/public-npm | ||
RUN rsync -ar /var/www/html/public-npm/ /var/www/html/public/ \ | ||
&& rm -rf /var/www/html/public-npm \ | ||
&& chown -R www-data:www-data /var/www/html/public | ||
|
||
EXPOSE 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,6 @@ | ||
{ | ||
"require": { | ||
"laravel/framework": "^10.0.0", | ||
"laravel/octane" : "*" | ||
} | ||
} |
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 @@ | ||
rr |
Oops, something went wrong.