feat: add melli db init to docker services

This commit is contained in:
Derrick Hammer 2023-12-24 22:45:49 -05:00
parent 1ea38add64
commit 0ca9099d31
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 14 additions and 0 deletions

View File

@ -15,3 +15,9 @@ services:
image: getmeili/meilisearch:v1.5 image: getmeili/meilisearch:v1.5
volumes: volumes:
- ./melli_data:/meili_data - ./melli_data:/meili_data
melli_init:
build: .
command: ["npm", "run", "melli-init"]
volumes:
- ./data/app.db:/app/prisma/dev.db
profiles: ["mellisearch_init"]

View File

@ -17,6 +17,7 @@
"start": "remix-serve ./build/server/index.js", "start": "remix-serve ./build/server/index.js",
"typecheck": "tsc", "typecheck": "tsc",
"bridge": "bun run scripts/bridge.mts", "bridge": "bun run scripts/bridge.mts",
"melli-init": "bun run scripts/melli-init.mts",
"postinstall": "patch-package" "postinstall": "patch-package"
}, },
"dependencies": { "dependencies": {

7
scripts/melli-init.mts Normal file
View File

@ -0,0 +1,7 @@
import search from "../app/lib/search";
await search.createIndex("articles", { primaryKey: "id" });
const index = search.index("articles");
await index.updateFilterableAttributes(["site", "createdTimestamp"]);