mirror of
https://github.com/shishantbiswas/bknd-examples.git
synced 2026-02-27 03:51:17 +00:00
add: docker compose
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
.env
|
||||
.output
|
||||
.nitro
|
||||
.vscode
|
||||
dist
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,5 +11,4 @@ count.txt
|
||||
.output
|
||||
.vinxi
|
||||
todos.json
|
||||
data.db
|
||||
public/uploads
|
||||
@@ -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",
|
||||
});
|
||||
},
|
||||
|
||||
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
@@ -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:
|
||||
Reference in New Issue
Block a user