Skip to content

Commit

Permalink
Merge pull request #186 from greymass/bun-server
Browse files Browse the repository at this point in the history
Docker + bun
  • Loading branch information
aaroncox authored Nov 4, 2024
2 parents 1f7d953 + eaa7ce4 commit 9ffa644
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 61 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.svelte-kit
build
docker
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
.github
.svelte-kit
.wrangler
README.md
src/lib/paraglide
LICENSE
.vscode
Makefile
helm-charts
.editorconfig
.idea
coverage*
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:22 AS base
WORKDIR /usr/src/app
RUN npm install -g bun

COPY package*.json bun.lockb ./
RUN bun install
COPY . .

ENV NODE_ENV production
RUN bun run build-docker

CMD [ "bun", "build/index.js" ]
Binary file modified bun.lockb
Binary file not shown.
24 changes: 24 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.8"
services:
nginx:
image: nginx:latest
depends_on:
- sveltekit
networks:
- unicove
ports:
- "8000:8000"
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
sveltekit:
build:
context: .
dockerfile: Dockerfile
expose:
- "3000"
networks:
- unicove
restart: always

networks:
unicove:
18 changes: 18 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
user nginx;

events {
worker_connections 10000;
}

http {
proxy_buffer_size 512k;
proxy_buffers 5 512k;
proxy_busy_buffers_size 512k;

server {
listen 8000;
location / {
proxy_pass http://sveltekit:3000;
}
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dev": "vite dev",
"build-paraglide": "npx @inlang/paraglide-js compile --project ./project.inlang --outdir ./src/lib/paraglide",
"build": "bun run build-paraglide && vite build",
"build-docker": "bun run build-paraglide && ADAPTER=bun vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Expand All @@ -23,7 +24,7 @@
"@sveltejs/adapter-auto": "^3.2.2",
"@sveltejs/adapter-cloudflare": "^4.7.0",
"@sveltejs/kit": "^2.5.18",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"@types/big.js": "^6.2.2",
"@types/bun": "^1.1.10",
"@types/eslint": "^8.56.11",
Expand All @@ -36,7 +37,8 @@
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-tailwindcss": "^0.6.5",
"svelte": "^5.0.5",
"svelte": "^5.1.9",
"svelte-adapter-bun": "^0.5.2",
"svelte-check": "^3.8.6",
"tailwindcss": "^3.4.7",
"tslib": "^2.6.3",
Expand Down Expand Up @@ -81,6 +83,7 @@
"resolutions": {
"@wharfkit/antelope": "^1.0.11",
"@wharfkit/common": "^1.4.0",
"@wharfkit/session": "^1.4.0"
"@wharfkit/session": "^1.4.0",
"svelte": "^5.1.9"
}
}
6 changes: 3 additions & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { preprocessMeltUI, sequence } from '@melt-ui/pp';
// import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-auto';
import adapterAuto from '@sveltejs/adapter-auto';
import adapterBun from 'svelte-adapter-bun';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config}*/
const config = {
Expand All @@ -11,7 +11,7 @@ const config = {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter: process.env.ADAPTER === 'bun' ? adapterBun() : adapterAuto()
}
};
export default config;
108 changes: 53 additions & 55 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: C2BD22648A232400-a56d16df6142dd96-64A76832A6B0321F-c7ed1539714a48e9
# bun ./bun.lockb --hash: 47641AD3CA1BC51F-c65da9fabcc9d0e8-B2A9A9B066FC0EB9-5b255a8dcbae36f0


"@alloc/quick-lru@^5.2.0":
version "5.2.0"
resolved "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz"
integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==

"@ampproject/remapping@^2.2.1", "@ampproject/remapping@^2.3.0":
"@ampproject/remapping@^2.3.0":
version "2.3.0"
resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz"
integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==
Expand Down Expand Up @@ -1232,7 +1232,7 @@
sirv "^2.0.4"
tiny-glob "^0.2.9"

"@sveltejs/vite-plugin-svelte@^3.0.0", "@sveltejs/vite-plugin-svelte@^3.1.1":
"@sveltejs/vite-plugin-svelte@^3.0.0":
version "3.1.1"
resolved "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.1.1.tgz"
integrity sha512-rimpFEAboBBHIlzISibg94iP09k/KYdHgVhJlcsTfn7KMBhc70jFX/GRWkRdFCc2fdnk+4+Bdfej23cMDnJS6A==
Expand All @@ -1245,13 +1245,32 @@
magic-string "^0.30.10"
"@sveltejs/vite-plugin-svelte-inspector" "^2.1.0"

"@sveltejs/vite-plugin-svelte@^4.0.0-next.0||^4.0.0", "@sveltejs/vite-plugin-svelte@^4.0.0-next.6":
version "4.0.0"
resolved "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-4.0.0.tgz"
integrity sha512-kpVJwF+gNiMEsoHaw+FJL76IYiwBikkxYU83+BpqQLdVMff19KeRKLd2wisS8niNBMJ2omv5gG+iGDDwd8jzag==
dependencies:
"@sveltejs/vite-plugin-svelte-inspector" "^3.0.0-next.0||^3.0.0"
debug "^4.3.7"
deepmerge "^4.3.1"
kleur "^4.1.5"
magic-string "^0.30.12"
vitefu "^1.0.3"

"@sveltejs/vite-plugin-svelte-inspector@^2.1.0":
version "2.1.0"
resolved "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.1.0.tgz"
integrity sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==
dependencies:
debug "^4.3.4"

"@sveltejs/vite-plugin-svelte-inspector@^3.0.0-next.0||^3.0.0":
version "3.0.1"
resolved "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-3.0.1.tgz"
integrity sha512-2CKypmj1sM4GE7HjllT7UKmo4Q6L5xFRd7VMGEWhYnZ+wc6AUVU01IBd7yUi6WnFndEwWoMNOd6e8UjoN0nbvQ==
dependencies:
debug "^4.3.7"

"@swc/helpers@^0.5.0":
version "0.5.12"
resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.12.tgz"
Expand Down Expand Up @@ -1647,7 +1666,7 @@
resolved "https://registry.npmjs.org/@wharfkit/web-renderer/-/web-renderer-1.4.1.tgz"
integrity sha512-ky/keS0rHxJcdIWLo7d9H6eo+rK0l2mQj/3xOCwVaDKBAd/dTQwuqYIzOYMC9azdyMglgNcTRgYWm5PJrU4lIA==

acorn@>=8.9.0, "acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.11.0, acorn@^8.11.2, acorn@^8.11.3, acorn@^8.12.0, acorn@^8.12.1, acorn@^8.8.0, acorn@^8.9.0:
acorn@>=8.9.0, "acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.11.0, acorn@^8.11.2, acorn@^8.12.0, acorn@^8.12.1, acorn@^8.8.0, acorn@^8.9.0:
version "8.12.1"
resolved "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz"
integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==
Expand Down Expand Up @@ -1732,13 +1751,6 @@ argparse@^2.0.1:
resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

aria-query@^5.3.0:
version "5.3.0"
resolved "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz"
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
dependencies:
dequal "^2.0.3"

aria-query@^5.3.1:
version "5.3.2"
resolved "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz"
Expand Down Expand Up @@ -1801,7 +1813,7 @@ axios@^1.7.4:
proxy-from-env "^1.1.0"
follow-redirects "^1.15.6"

axobject-query@^4.0.0, axobject-query@^4.1.0:
axobject-query@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz"
integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==
Expand Down Expand Up @@ -2169,6 +2181,13 @@ debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
dependencies:
ms "2.1.2"

debug@^4.3.7:
version "4.3.7"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "^2.1.3"

dedent@1.5.1:
version "1.5.1"
resolved "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz"
Expand Down Expand Up @@ -3200,7 +3219,7 @@ magic-string@^0.30.10, magic-string@^0.30.5:
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"

magic-string@^0.30.11:
magic-string@^0.30.11, magic-string@^0.30.12:
version "0.30.12"
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz"
integrity sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==
Expand Down Expand Up @@ -3337,6 +3356,11 @@ ms@2.1.2, ms@^2.1.1:
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

ms@^2.1.3:
version "2.1.3"
resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

murmurhash3js@^3.0.1:
version "3.0.1"
resolved "https://registry.npmjs.org/murmurhash3js/-/murmurhash3js-3.0.1.tgz"
Expand Down Expand Up @@ -4065,48 +4089,10 @@ svead@^0.0.11:
resolved "https://registry.npmjs.org/svead/-/svead-0.0.11.tgz"
integrity sha512-lkBgdXjhWz4Vvi3GeE7LpOSyY0OqgUdSAZVmdVOjpgpl/3an/UlSO/l6tp2lwM5dGZjDruMv2NcC5zG33jDhbA==

"svelte@^3.0.0 || ^4.0.0 || ^5.0.0-next.118", "svelte@^3.19.0 || ^4.0.0", "svelte@^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0", "svelte@^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", "svelte@^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0", "svelte@^3.55.0 || ^4.0.0 || ^5.0.0-next.1", "svelte@^4.0.0 || ^5.0.0", "svelte@^4.0.0 || ^5.0.0-next.0", "svelte@^5.0.0 || ^5.0.0-next.1 || ^5.0.0-rc.1":
version "5.0.0-next.199"
resolved "https://registry.npmjs.org/svelte/-/svelte-5.0.0-next.199.tgz"
integrity sha512-DOww/AlABK2cBQ/SIBlAT3TLT6LldmOMlPogh90cA9md5hAnxfIIQ28HgZbbgbwHAeX4+zsrX52Oke8ycV+a6A==
dependencies:
"@ampproject/remapping" "^2.2.1"
"@jridgewell/sourcemap-codec" "^1.4.15"
"@types/estree" "^1.0.5"
acorn "^8.11.3"
acorn-typescript "^1.4.13"
aria-query "^5.3.0"
axobject-query "^4.0.0"
esm-env "^1.0.0"
esrap "^1.2.2"
is-reference "^3.0.2"
locate-character "^3.0.0"
magic-string "^0.30.5"
zimmerframe "^1.1.2"

"svelte@^3 || ^4 || ^5.0.0-next.42":
version "5.0.0-next.210"
resolved "https://registry.npmjs.org/svelte/-/svelte-5.0.0-next.210.tgz"
integrity sha512-6QZpzr31weKDyAKifOdXJHK9oEeBE2Z/z/h1IX4tmJRuWPE/2Wc7Lzpfxl+0irS19GZH6V5YZnZLNTRJKjGzfg==
dependencies:
"@ampproject/remapping" "^2.2.1"
"@jridgewell/sourcemap-codec" "^1.4.15"
"@types/estree" "^1.0.5"
acorn "^8.11.3"
acorn-typescript "^1.4.13"
aria-query "^5.3.0"
axobject-query "^4.0.0"
esm-env "^1.0.0"
esrap "^1.2.2"
is-reference "^3.0.2"
locate-character "^3.0.0"
magic-string "^0.30.5"
zimmerframe "^1.1.2"

"svelte@^3.55.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", "svelte@^5.0.0-next.1", svelte@^5.0.5:
version "5.0.5"
resolved "https://registry.npmjs.org/svelte/-/svelte-5.0.5.tgz"
integrity sha512-f4WBlP5g8W6pEoDfx741lewMlemy+LIGpEqjGPWqnHVP92wqlQXl87U5O5Bi2tkSUrO95OxOoqwU8qlqiHmFKA==
"svelte@^3 || ^4 || ^5.0.0-next.42", "svelte@^3.0.0 || ^4.0.0 || ^5.0.0-next.118", "svelte@^3.19.0 || ^4.0.0", "svelte@^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0", "svelte@^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", "svelte@^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0", "svelte@^3.55.0 || ^4.0.0 || ^5.0.0-next.1", "svelte@^3.55.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", "svelte@^4.0.0 || ^5.0.0", "svelte@^4.0.0 || ^5.0.0-next.0", "svelte@^5.0.0 || ^5.0.0-next.1 || ^5.0.0-rc.1", "svelte@^5.0.0-next.1", "svelte@^5.0.0-next.96 || ^5.0.0", svelte@^5.1.9:
version "5.1.9"
resolved "https://registry.npmjs.org/svelte/-/svelte-5.1.9.tgz"
integrity sha512-nzq+PPKGS2PoEWDjAcXSrKSbXmmmOAxd6dAz1IhRusUpVkFS6DMELWPyBPGwu6TpO/gsgtFXwX0M4+pAR5gzKw==
dependencies:
"@ampproject/remapping" "^2.3.0"
"@jridgewell/sourcemap-codec" "^1.5.0"
Expand All @@ -4122,6 +4108,13 @@ svead@^0.0.11:
magic-string "^0.30.11"
zimmerframe "^1.1.2"

svelte-adapter-bun@^0.5.2:
version "0.5.2"
resolved "https://registry.npmjs.org/svelte-adapter-bun/-/svelte-adapter-bun-0.5.2.tgz"
integrity sha512-xEtFgaal6UgrCwwkSIcapO9kopoFNUYCYqyKCikdqxX9bz2TDYnrWQZ7qBnkunMxi1HOIERUCvTcebYGiarZLA==
dependencies:
tiny-glob "^0.2.9"

svelte-check@^3.8.6:
version "3.8.6"
resolved "https://registry.npmjs.org/svelte-check/-/svelte-check-3.8.6.tgz"
Expand Down Expand Up @@ -4406,6 +4399,11 @@ vitefu@^0.2.5:
resolved "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz"
integrity sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==

vitefu@^1.0.3:
version "1.0.3"
resolved "https://registry.npmjs.org/vitefu/-/vitefu-1.0.3.tgz"
integrity sha512-iKKfOMBHob2WxEJbqbJjHAkmYgvFDPhuqrO82om83S8RLk+17FtyMBfcyeH8GqD0ihShtkMW/zzJgiA51hCNCQ==

"webextension-polyfill@^0.10.0 || ^0.11.0 || ^0.12.0":
version "0.12.0"
resolved "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.12.0.tgz"
Expand Down

0 comments on commit 9ffa644

Please sign in to comment.