From d3fdfc400f07adfd993bb6ceb8d95c512565f1ea Mon Sep 17 00:00:00 2001 From: mortexa Date: Thu, 26 Sep 2024 18:11:32 +0330 Subject: [PATCH 1/2] Build frontend assets with Bun --- FrankenPHP.Alpine.Dockerfile | 19 ++++++------------- FrankenPHP.Dockerfile | 19 ++++++------------- README.md | 2 +- RoadRunner.Alpine.Dockerfile | 19 ++++++------------- RoadRunner.Dockerfile | 19 ++++++------------- Swoole.Alpine.Dockerfile | 19 ++++++------------- Swoole.Dockerfile | 19 ++++++------------- 7 files changed, 37 insertions(+), 79 deletions(-) diff --git a/FrankenPHP.Alpine.Dockerfile b/FrankenPHP.Alpine.Dockerfile index 77da134..8e7d779 100644 --- a/FrankenPHP.Alpine.Dockerfile +++ b/FrankenPHP.Alpine.Dockerfile @@ -6,31 +6,24 @@ ARG FRANKENPHP_VERSION=latest ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### diff --git a/FrankenPHP.Dockerfile b/FrankenPHP.Dockerfile index c1f4b01..482291e 100644 --- a/FrankenPHP.Dockerfile +++ b/FrankenPHP.Dockerfile @@ -6,31 +6,24 @@ ARG FRANKENPHP_VERSION=latest ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### diff --git a/README.md b/README.md index 7b6bf3d..f3b60e5 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ Also, some useful Bash functions and aliases are added in `utilities.sh` that ma ## ToDo - [x] Add support for PHP 8.3 - [x] Add support for worker mode -- [ ] Build assets with Bun +- [x] Build assets with Bun - [ ] Create standalone and self-executable app - [x] Add support for Horizon - [x] Add support for RoadRunner diff --git a/RoadRunner.Alpine.Dockerfile b/RoadRunner.Alpine.Dockerfile index a1801ac..65e7424 100644 --- a/RoadRunner.Alpine.Dockerfile +++ b/RoadRunner.Alpine.Dockerfile @@ -4,31 +4,24 @@ ARG PHP_VERSION=8.3 ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### diff --git a/RoadRunner.Dockerfile b/RoadRunner.Dockerfile index a492dd0..a14a54a 100644 --- a/RoadRunner.Dockerfile +++ b/RoadRunner.Dockerfile @@ -4,31 +4,24 @@ ARG PHP_VERSION=8.3 ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### diff --git a/Swoole.Alpine.Dockerfile b/Swoole.Alpine.Dockerfile index 9ff15f1..6676775 100644 --- a/Swoole.Alpine.Dockerfile +++ b/Swoole.Alpine.Dockerfile @@ -4,31 +4,24 @@ ARG PHP_VERSION=8.3 ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### diff --git a/Swoole.Dockerfile b/Swoole.Dockerfile index 0534acb..cfef60b 100644 --- a/Swoole.Dockerfile +++ b/Swoole.Dockerfile @@ -4,31 +4,24 @@ ARG PHP_VERSION=8.3 ARG COMPOSER_VERSION=latest ########################################### -# Build frontend assets with NPM +# Build frontend assets with Bun ########################################### -ARG NODE_VERSION=20-alpine +ARG BUN_VERSION="latest" -FROM node:${NODE_VERSION} AS build +FROM oven/bun:${BUN_VERSION} AS build ENV ROOT=/var/www/html WORKDIR ${ROOT} -RUN npm config set update-notifier false && npm set progress=false +COPY --link package.json bun.lockb ./ -COPY --link package*.json ./ - -RUN if [ -f $ROOT/package-lock.json ]; \ - then \ - npm ci --loglevel=error --no-audit; \ - else \ - npm install --loglevel=error --no-audit; \ - fi +RUN bun install --frozen-lockfile COPY --link . . -RUN npm run build +RUN bun run build ########################################### From 1684a70b0fa6780b783dda9574f76d1f1a8a25cc Mon Sep 17 00:00:00 2001 From: mortexa Date: Thu, 26 Sep 2024 18:20:40 +0330 Subject: [PATCH 2/2] wip --- FrankenPHP.Alpine.Dockerfile | 2 +- FrankenPHP.Dockerfile | 2 +- RoadRunner.Alpine.Dockerfile | 2 +- RoadRunner.Dockerfile | 2 +- Swoole.Alpine.Dockerfile | 2 +- Swoole.Dockerfile | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FrankenPHP.Alpine.Dockerfile b/FrankenPHP.Alpine.Dockerfile index 8e7d779..72bf535 100644 --- a/FrankenPHP.Alpine.Dockerfile +++ b/FrankenPHP.Alpine.Dockerfile @@ -17,7 +17,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile diff --git a/FrankenPHP.Dockerfile b/FrankenPHP.Dockerfile index 482291e..b7b29e8 100644 --- a/FrankenPHP.Dockerfile +++ b/FrankenPHP.Dockerfile @@ -17,7 +17,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile diff --git a/RoadRunner.Alpine.Dockerfile b/RoadRunner.Alpine.Dockerfile index 65e7424..bc68127 100644 --- a/RoadRunner.Alpine.Dockerfile +++ b/RoadRunner.Alpine.Dockerfile @@ -15,7 +15,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile diff --git a/RoadRunner.Dockerfile b/RoadRunner.Dockerfile index a14a54a..5b0269b 100644 --- a/RoadRunner.Dockerfile +++ b/RoadRunner.Dockerfile @@ -15,7 +15,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile diff --git a/Swoole.Alpine.Dockerfile b/Swoole.Alpine.Dockerfile index 6676775..768f228 100644 --- a/Swoole.Alpine.Dockerfile +++ b/Swoole.Alpine.Dockerfile @@ -15,7 +15,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile diff --git a/Swoole.Dockerfile b/Swoole.Dockerfile index cfef60b..579f79f 100644 --- a/Swoole.Dockerfile +++ b/Swoole.Dockerfile @@ -15,7 +15,7 @@ ENV ROOT=/var/www/html WORKDIR ${ROOT} -COPY --link package.json bun.lockb ./ +COPY --link package.json bun.lockb* ./ RUN bun install --frozen-lockfile