diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f97fb5d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +# flyctl launch added from .gitignore +# deps +**/node_modules +**/.env +**/my.db +fly.toml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1e17a5b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM oven/bun:1 +WORKDIR /app + +COPY package.json bun.lock ./ +RUN bun install --frozen-lockfile + +COPY . . + +RUN mkdir -p /data + +EXPOSE 3000 + +CMD ["bun", "run", "src/index.ts"] diff --git a/bun.lock b/bun.lock index e0ab2b7..5c43c9e 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,6 @@ "": { "name": "haxmas-day-4", "dependencies": { - "better-sqlite3": "^12.5.0", "dotenv": "^17.2.3", "drizzle-orm": "^0.45.1", "hono": "^4.11.1", diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..eb248a3 --- /dev/null +++ b/fly.toml @@ -0,0 +1,20 @@ +# fly.toml app configuration file generated for wishlist-api-hc on 2025-12-17T04:37:10-07:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'wishlist-api-hc' +primary_region = 'lax' + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[[vm]] + memory = '1gb' + cpus = 1 + memory_mb = 1024 diff --git a/package.json b/package.json index b08725d..f99d0d4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "dev": "bun run --hot src/index.ts" }, "dependencies": { - "better-sqlite3": "^12.5.0", "dotenv": "^17.2.3", "drizzle-orm": "^0.45.1", "hono": "^4.11.1" diff --git a/src/db/index.ts b/src/db/index.ts index 40aa020..125e82b 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,4 +1,5 @@ import "dotenv/config"; import { drizzle } from "drizzle-orm/bun-sqlite"; +import { Database } from "bun:sqlite"; -export const db = drizzle(process.env.DB_FILE_NAME!); +export const db = drizzle(new Database(process.env.DB_FILE_NAME!));