add example docker-compose, fix db location
M.dockerignore
@@ -40,5 +40,5 @@ yarn-error.log*
**/*.log
package-lock.json
**/*.bun
*.sqlite
db
assets/dist
M.gitignore
@@ -40,5 +40,5 @@ yarn-error.log*
**/*.log
package-lock.json
**/*.bun
*.sqlite
db
assets/dist
Adocker-compose.yml
@@ -0,0 +1,9 @@
services:
zigbin:
build:
context: .
dockerfile: Dockerfile
volumes:
- ./db:/app/db
ports:
- 3000:3000
Msrc/index.ts
@@ -7,10 +7,7 @@ import crypto from 'crypto'
import { DecryptFile, filetypes, Index, NotFound, SetCookie, ShowFile, WrongPassword } from "./components"
import cron from "@elysiajs/cron"
//TODO: add deletion timer
const db = new Database("./db.sqlite")
const db = new Database("./db/db.sqlite")
db.exec("PRAGMA foreign_keys = ON")
db.exec("PRAGMA journal_mode = WAL2")
db.exec("CREATE TABLE IF NOT EXISTS files (uuid TEXT PRIMARY KEY, filename TEXT NOT NULL, content BLOB NOT NULL, filetype TEXT NOT NULL, encrypted INTEGER NOT NULL, delete_at INTEGER) STRICT")