Add Migrations
This commit is contained in:
@@ -42,8 +42,12 @@ COPY . .
|
||||
# Build TypeScript
|
||||
RUN npm run build
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY docker-entrypoint.sh /app/
|
||||
RUN chmod +x /app/docker-entrypoint.sh
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start application (migrations will be run via docker-compose command)
|
||||
CMD ["npm", "start"]
|
||||
# Start application with migrations
|
||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||
|
||||
8
backend/docker-entrypoint.sh
Normal file
8
backend/docker-entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Running database migrations..."
|
||||
npx prisma migrate deploy
|
||||
|
||||
echo "Starting application..."
|
||||
exec npm start
|
||||
@@ -17,6 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.5.0",
|
||||
"dotenv": "^17.2.3",
|
||||
"electron": "^30.0.0",
|
||||
"electron-updater": "^6.1.0",
|
||||
"recharts": "^3.5.1",
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
import { app, BrowserWindow, Tray, Menu, nativeImage } from 'electron';
|
||||
import * as path from 'path';
|
||||
import * as dotenv from 'dotenv';
|
||||
import { setupIpcHandlers, cleanupIpcHandlers } from './ipc-handlers';
|
||||
import { initDatabase, closeDatabase } from './database';
|
||||
|
||||
// Load environment variables from .env file
|
||||
// In dev: __dirname = dist/main, so go up to electron-app root
|
||||
// In prod: __dirname = resources/app.asar/dist/main, .env should be in resources
|
||||
const envPath = process.env.NODE_ENV === 'development'
|
||||
? path.join(__dirname, '../../.env')
|
||||
: path.join(process.resourcesPath, '.env');
|
||||
dotenv.config({ path: envPath });
|
||||
|
||||
console.log('Loading .env from:', envPath);
|
||||
console.log('WS_URL:', process.env.WS_URL);
|
||||
console.log('API_URL:', process.env.API_URL);
|
||||
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
let tray: Tray | null = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user