fix: archivos deploy
This commit is contained in:
+10
-3
@@ -18,6 +18,14 @@ ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
|||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Next.js standalone creates a subdirectory named after the project folder.
|
||||||
|
# We flatten it to a known location so the runner doesn't depend on the name.
|
||||||
|
RUN echo "=== Standalone output structure ===" && \
|
||||||
|
ls -la /app/.next/standalone/ && \
|
||||||
|
mkdir -p /app/.next/standalone-export && \
|
||||||
|
cp -r /app/.next/standalone/*/ /app/.next/standalone-export/ && \
|
||||||
|
ls -la /app/.next/standalone-export/
|
||||||
|
|
||||||
# ─── Stage 2: Production Runner ────────────────────────────────────────────
|
# ─── Stage 2: Production Runner ────────────────────────────────────────────
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -30,9 +38,8 @@ ENV HOSTNAME=0.0.0.0
|
|||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Next.js standalone output includes a subdir named after the project.
|
# Copy flattened standalone output (server.js is now directly in /app)
|
||||||
# Copy from standalone/cirux/ directly to /app
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone-export/ ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/cirux/ ./
|
|
||||||
|
|
||||||
# Copy static assets (images, fonts, etc.)
|
# Copy static assets (images, fonts, etc.)
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ sleep 10
|
|||||||
|
|
||||||
RETRIES=5
|
RETRIES=5
|
||||||
while [ $RETRIES -gt 0 ]; do
|
while [ $RETRIES -gt 0 ]; do
|
||||||
if curl -sf http://localhost:3020/api/health > /dev/null 2>&1; then
|
if curl -sf http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploy successful ✅" >> "$LOG_FILE"
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploy successful ✅" >> "$LOG_FILE"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
+3
-3
@@ -13,11 +13,11 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
expose:
|
ports:
|
||||||
- "3020"
|
- "127.0.0.1:3020:3020"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|||||||
Reference in New Issue
Block a user