Skip to content

Commit

Permalink
Build frontend assets with Bun (#90)
Browse files Browse the repository at this point in the history
Build frontend assets with Bun
  • Loading branch information
smortexa authored Sep 26, 2024
1 parent f718099 commit f886de7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 79 deletions.
19 changes: 6 additions & 13 deletions FrankenPHP.Alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down
19 changes: 6 additions & 13 deletions FrankenPHP.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 6 additions & 13 deletions RoadRunner.Alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down
19 changes: 6 additions & 13 deletions RoadRunner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down
19 changes: 6 additions & 13 deletions Swoole.Alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down
19 changes: 6 additions & 13 deletions Swoole.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

###########################################

Expand Down

0 comments on commit f886de7

Please sign in to comment.