From eac571934c8e8bd2bc56b92180f13019a9c9ce0a Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Fri, 23 Aug 2024 13:22:44 +0800 Subject: [PATCH] nixpacks --- nixpacks.toml | 29 +++++++++++++++++++++++++++++ ui/src/repository/api.ts | 4 +++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 nixpacks.toml diff --git a/nixpacks.toml b/nixpacks.toml new file mode 100644 index 00000000..fcb3642c --- /dev/null +++ b/nixpacks.toml @@ -0,0 +1,29 @@ +providers = [] +buildImage = 'ghcr.io/railwayapp/nixpacks:ubuntu-1707782610' + +[variables] +CGO_ENABLED = '0' +NIXPACKS_METADATA = 'go' +PORT = '8090' + +[phases.build] +paths = ['/bin','/usr/local/bin'] +dependsOn = [ + 'install', + 'setup', +] +cmds = ['npm --prefix=./ui run build','go build -o out'] +cacheDirectories = ['/root/.cache/go-build'] + +[phases.install] +dependsOn = ['setup'] +cmds = ['go mod download',"npm --prefix=./ui ci"] +cacheDirectories = ['/root/.cache/go-build'] + +[phases.setup] +nixPkgs = ['go','node'] +nixOverlays = [] +nixpkgsArchive = '1f13eabcd6f5b00fe9de9575ac52c66a0e887ce6' + +[start] +cmd = './out serve --http=0.0.0.0:8090 --dir=/data/pb_data ' \ No newline at end of file diff --git a/ui/src/repository/api.ts b/ui/src/repository/api.ts index 6e54db6a..4cc8af29 100644 --- a/ui/src/repository/api.ts +++ b/ui/src/repository/api.ts @@ -1,7 +1,9 @@ import PocketBase from "pocketbase"; +const apiDomain = import.meta.env.VITE_API_DOMAIN; +console.log(apiDomain); let pb: PocketBase; export const getPb = () => { if (pb) return pb; - pb = new PocketBase("http://127.0.0.1:8090"); + pb = new PocketBase(apiDomain ? apiDomain : "http://127.0.0.1:8090"); return pb; };