feat: Implement multi-stage Dockerfile for robust Nuxt build

This commit is contained in:
2025-10-01 21:25:20 -04:00
parent 8abff8a764
commit a36a97c9f9
2 changed files with 19 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
FROM node:24-alpine
# Stage 1: Builder
FROM node:24-alpine AS builder
# Install dumb-init, Python, and build tools for native builds
RUN apk add --no-cache dumb-init python3 build-base
@@ -9,8 +10,8 @@ WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install --production
# Install all dependencies (including dev dependencies for building)
RUN npm install
# Copy application code
COPY . .
@@ -18,6 +19,21 @@ COPY . .
# Build the application
RUN npm run build
# Stage 2: Runner
FROM node:24-alpine
# Install dumb-init for signal handling
RUN apk add --no-cache dumb-init
# Set working directory
WORKDIR /app
# Copy only production dependencies from builder stage
COPY --from=builder /app/node_modules ./node_modules
# 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

View File

@@ -18,9 +18,6 @@ export default defineNuxtConfig({
nitro: {
experimental: {
wasm: true
},
externals: {
external: ['tailwindcss']
}
},
vite: {
@@ -30,12 +27,6 @@ export default defineNuxtConfig({
}
}
},
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
app: {
head: {
link: [