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
|
# Stage 2: Runner
|
||||||
FROM node:24-alpine
|
FROM node:24-alpine
|
||||||
|
|
||||||
# Install dumb-init for signal handling
|
# Install dumb-init, wget for healthcheck, and build tools for native modules
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init wget python3 build-base
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
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
|
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 the built application from builder stage
|
||||||
COPY --from=builder /app/.output ./.output
|
COPY --from=builder /app/.output ./.output
|
||||||
|
|
||||||
# Create data directory and database file for SQLite
|
# Create data directory (don't pre-create database file)
|
||||||
RUN mkdir -p /app/data && touch /app/data/sermons.db
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ services:
|
|||||||
- JWT_SECRET=d8c7c1735fc853b807c1bccce791b054
|
- JWT_SECRET=d8c7c1735fc853b807c1bccce791b054
|
||||||
- ADMIN_PASSWORD=admin123
|
- ADMIN_PASSWORD=admin123
|
||||||
volumes:
|
volumes:
|
||||||
- sermon_data:/data
|
- sermon_data:/app/data
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
|
||||||
@@ -19,4 +19,4 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
sermon_data:
|
sermon_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
|
compatibilityDate: '2024-04-03',
|
||||||
devtools: { enabled: false },
|
devtools: { enabled: false },
|
||||||
modules: [
|
modules: [
|
||||||
'@nuxt/ui'
|
'@nuxt/ui'
|
||||||
@@ -20,15 +21,9 @@ export default defineNuxtConfig({
|
|||||||
wasm: true
|
wasm: true
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
external: ['tailwindcss', 'tailwindcss/colors']
|
inline: ['better-sqlite3']
|
||||||
}
|
},
|
||||||
},
|
moduleSideEffects: ['better-sqlite3']
|
||||||
vite: {
|
|
||||||
build: {
|
|
||||||
rollupOptions: {
|
|
||||||
external: ['better-sqlite3', 'path', 'fs', 'crypto', 'bcryptjs']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
head: {
|
head: {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.4.0",
|
"typescript": "^5.4.0",
|
||||||
|
"@types/node": "^20.0.0",
|
||||||
"@types/better-sqlite3": "^7.6.8",
|
"@types/better-sqlite3": "^7.6.8",
|
||||||
"@types/qrcode": "^1.5.5"
|
"@types/qrcode": "^1.5.5"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user