This commit is contained in:
2026-02-06 16:26:27 +09:00
parent b9919df00b
commit aa6667235a
2 changed files with 10 additions and 1 deletions

View File

@@ -28,6 +28,9 @@ COPY --from=build /app/dist ./dist
COPY server.js .
COPY favicon.png .
# 데이터베이스 디렉토리 생성
RUN mkdir -p db
# 환경변수 포트 노출 (Dokploy 등에서 PORT 주입 시 사용됨)
ENV PORT=80
EXPOSE 80

View File

@@ -4,6 +4,7 @@ import sqlite3 from 'sqlite3';
import cors from 'cors';
import { open } from 'sqlite';
import path from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
@@ -21,7 +22,12 @@ app.use(express.json());
let db;
async function initializeDB() {
const dbPath = path.join(__dirname, 'wifi_markers.db');
const dbDir = path.join(__dirname, 'db');
if (!fs.existsSync(dbDir)) {
fs.mkdirSync(dbDir, { recursive: true });
}
const dbPath = path.join(dbDir, 'wifi_markers.db');
db = await open({
filename: dbPath,
driver: sqlite3.Database