diff --git a/Dockerfile b/Dockerfile index bbdbd09..54ff657 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,20 +22,26 @@ RUN npm run build # Stage 2: Runner FROM node:24-alpine -# Install dumb-init for signal handling -RUN apk add --no-cache dumb-init +# Install dumb-init, wget for healthcheck, and build tools for native modules +RUN apk add --no-cache dumb-init wget python3 build-base # Set working directory WORKDIR /app -# Copy only production dependencies from builder stage +# Copy package files for rebuilding native modules +COPY --from=builder /app/package*.json ./ + +# Copy node_modules from builder COPY --from=builder /app/node_modules ./node_modules +# Rebuild native modules for production environment +RUN npm rebuild better-sqlite3 + # Copy the built application from builder stage COPY --from=builder /app/.output ./.output -# Create data directory and database file for SQLite -RUN mkdir -p /app/data && touch /app/data/sermons.db +# Create data directory (don't pre-create database file) +RUN mkdir -p /app/data # Expose port EXPOSE 3000 diff --git a/docker-compose.yml b/docker-compose.yml index 8f8fae3..66b6d6c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - JWT_SECRET=d8c7c1735fc853b807c1bccce791b054 - ADMIN_PASSWORD=admin123 volumes: - - sermon_data:/data + - sermon_data:/app/data restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"] @@ -19,4 +19,4 @@ services: volumes: sermon_data: - driver: local \ No newline at end of file + driver: local diff --git a/nuxt.config.ts b/nuxt.config.ts index 4fb53c0..186267c 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,4 +1,5 @@ export default defineNuxtConfig({ + compatibilityDate: '2024-04-03', devtools: { enabled: false }, modules: [ '@nuxt/ui' @@ -20,15 +21,9 @@ export default defineNuxtConfig({ wasm: true }, externals: { - external: ['tailwindcss', 'tailwindcss/colors'] - } - }, - vite: { - build: { - rollupOptions: { - external: ['better-sqlite3', 'path', 'fs', 'crypto', 'bcryptjs'] - } - } + inline: ['better-sqlite3'] + }, + moduleSideEffects: ['better-sqlite3'] }, app: { head: { diff --git a/package.json b/package.json index 3242676..d68e522 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "devDependencies": { "typescript": "^5.4.0", + "@types/node": "^20.0.0", "@types/better-sqlite3": "^7.6.8", "@types/qrcode": "^1.5.5" }