[Bug] Medusa Docker build timeout and restart loop due to missing prebuild optimization

Status Closed — duplicate
Maintainer reply None cached
Activity 3 comments · opened Jan 8, 2026 · closed Jan 12, 2026

Bug Description
Tengo un servidor con 16GB de RAM pero Medusa entra en bucle de reinicio. Necesito optimizar el Dockerfile "herbolaria-backend/herbolaria-store/Dockerfile".

El problema es que el build tarda mucho al arrancar y Coolify mata el proceso por timeout.

Por favor realiza estos 3 cambios para pre-construir la imagen:

1\. En la etapa "builder" (Stage 2), busca "RUN npm run build" y cámbiala por:

  RUN npm run build \&\& npx medusa build

2\. En la etapa "runner" (Stage 3), agrega esta línea justo antes del "RUN chown...":

  COPY --from=builder /app/.medusa ./.medusa

3\. Al final del archivo, deja el CMD limpio para que arranque rápido:

  CMD \["sh", "-c", "npx medusa db:migrate \&\& npm run start"]

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.0
  • Feedback ID: 71a63422-cf3b-4795-9d55-55b29f9f667b

Errors

[]

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗