diff --git a/caddyfile b/caddyfile new file mode 100644 index 0000000..c07349f --- /dev/null +++ b/caddyfile @@ -0,0 +1,9 @@ +:8443 { + root * ./build + file_server + encode gzip + + tls internal { + on_demand + } +} diff --git a/package.json b/package.json index 4745eb3..78025b3 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "0.0.1", "private": true, "scripts": { - "dev": "vite dev", "build": "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" + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "dev": "vite dev", + "preview": "vite preview", + "serve": "./serve.sh" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.0.0", diff --git a/serve.sh b/serve.sh new file mode 100755 index 0000000..3af359b --- /dev/null +++ b/serve.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -eo pipefail +function ee { + printf "\e[2m$ %s\e[0m\n" "$*" + eval "$@" +} + +echo 'Starting local Caddy web server.' +echo -e '\e[1;35mURL: https://localhost:8443\e[0m' +echo -e '\e[1;93mPress [Ctrl] + C to exit...\e[0m' + +ee "docker run -v \"\$(git rev-parse --show-toplevel):/http\" -w '/http' -p '8443:8443' caddy caddy run --config caddyfile"