diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ef1d0c8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.env +.output +.nitro +.vscode +dist diff --git a/.gitignore b/.gitignore index 32c41f7..2040117 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,4 @@ count.txt .output .vinxi todos.json -data.db public/uploads \ No newline at end of file diff --git a/bknd.config.ts b/bknd.config.ts index 1f309b6..bec8ad9 100644 --- a/bknd.config.ts +++ b/bknd.config.ts @@ -1,4 +1,4 @@ -import { type BkndConfig, em, entity, text, boolean } from "bknd"; +import { type BkndConfig, em, entity, text, boolean, libsql } from "bknd"; // Unrelated to framework adapters import { registerLocalMediaAdapter } from "bknd/adapter/node"; @@ -19,9 +19,9 @@ declare module "bknd" { } export default { - connection: { - url: process.env.DB_URL ?? "file:data.db", - }, + connection: libsql({ + url: process.env.DATABASE_URL || "http://localhost:8080", + }), options: { // the seed option is only executed if the database was empty seed: async (ctx) => { @@ -33,7 +33,7 @@ export default { // and create a user await ctx.app.module.auth.createUser({ - email: "test@bknd.io", + email: "dswbx@bknd.io", password: "12345678", }); }, diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d7fcc89 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + deploy: + resources: + limits: + cpus: '0.5' + memory: 2G + restart_policy: + condition: on-failure + expose: + - 3000 + environment: + DATABASE_URL: http://db:8080 + depends_on: + - db + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:3000" ] + interval: 15s + timeout: 5s + retries: 3 + volumes: + - "./data:/app/data" + db: + image: ghcr.io/tursodatabase/libsql-server + volumes: + - libsql:/var/lib/sqld + +volumes: + libsql: \ No newline at end of file