Corrección Dockerfile
Deploy con Docker Compose / deploy (push) Has been cancelled

This commit is contained in:
2026-05-31 12:12:56 -05:00
parent 027c36b15c
commit 617c4dedb6
4 changed files with 29 additions and 33 deletions
+13 -17
View File
@@ -1,21 +1,16 @@
# ─── Stage 1: Dependencies ───────────────────────────────────────────────────
FROM node:20-alpine AS deps
# ─── Stage 1: Builder (install ALL deps + build) ────────────────────────────
FROM node:20-alpine AS builder
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Copy dependency files first (cache layer)
COPY package.json package-lock.json ./
RUN npm ci --only=production && npm cache clean --force
RUN npm ci && npm cache clean --force
# ─── Stage 2: Builder ────────────────────────────────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy source code
COPY . .
# Build the application (requires all env vars for static analysis)
# These are provided at build time via --build-arg or .env
# Build requires these env vars for static analysis
ARG NEXT_PUBLIC_SUPABASE_URL
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
@@ -23,7 +18,7 @@ ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
RUN npm run build
# ─── Stage 3: Production Runner ────────────────────────────────────────────
# ─── Stage 2: Production Runner ────────────────────────────────────────────
FROM node:20-alpine AS runner
WORKDIR /app
@@ -31,21 +26,22 @@ ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
# Add non-root user for security
# Create non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Next.js 15 standalone output puts files in a subdir named after the project.
# Copy everything from standalone/cirux/* to /app
# Next.js standalone output includes a subdir named after the project.
# Copy from standalone/cirux/ directly to /app
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/cirux/ ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Copy static assets (images, fonts, etc.)
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" || exit 1