Skip to content

Commit

Permalink
Migrate to bun (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
holzmaster authored Mar 17, 2024
1 parent 377e381 commit e629657
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 4,132 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ trim_trailing_whitespace = true
[*.{js,ts}]
indent_style = space
indent_size = 4

[package.json]
indent_style = space
indent_size = 2
7 changes: 3 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ jobs:
show-progress: false
fetch-depth: 0

- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v1
with:
node-version: '20'
cache: npm
bun-version: latest

- run: npm ci
- run: bun install
- run: npm run ci

build:
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"tsconfig.json": "tsconfig.*.json",
"package.json": "package-lock.json, .npmrc, yarn.lock, .yarnrc, .nvmrc",
"package.json": "package-lock.json, .npmrc, yarn.lock, .yarnrc, .nvmrc, bun.lockb",
"flake.nix": "flake.lock",
"*.ts": "$(capture).test.ts"
},
Expand Down
32 changes: 7 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
FROM node:21-slim as dependency-base
FROM oven/bun:latest as runtime-dependencies
WORKDIR /app
RUN apt-get update -yqq \
&& apt-get install -yqq \
python3 build-essential pkg-config \
&& apt-get clean -yqqq

FROM dependency-base as build
# Install dependencies (with dev-deps)
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci

COPY . /app/
RUN npm run compile

FROM dependency-base as runtime-dependencies
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
NODE_ENV=production npm ci
--mount=type=bind,source=bun.lockb,target=bun.lockb \
--mount=type=cache,target=/root/.bun/install/cache \
NODE_ENV=production bun install

FROM node:21-slim
FROM oven/bun:latest
WORKDIR /app
RUN apt-get update -yqqq \
&& apt-get install -yqqq \
Expand All @@ -39,8 +23,6 @@ FROM node:21-slim
RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime

COPY --from=runtime-dependencies /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/assets /app/assets
COPY --from=build /app/built /app/built
COPY ./ /app/

ENTRYPOINT ["node", "--es-module-specifier-resolution=node", "built/app.js"]
ENTRYPOINT ["bun", "src/app.ts"]
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit e629657

Please sign in to comment.