Fix deployment issues: native modules, volume mapping, Nuxt 4 config
This commit is contained in:
16
Dockerfile
16
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
|
||||
|
||||
@@ -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
|
||||
driver: local
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user