Quinta Nueva actualizacion al dockerFile
This commit is contained in:
23
Dockerfile
23
Dockerfile
@@ -3,7 +3,7 @@ ENV PNPM_HOME="/pnpm"
|
|||||||
ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
|
ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
# Instalación de las herramientas de compilación C/C++ y libvips en Debian
|
# 1. Dependencias nativas C++ y libvips del sistema
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
python3 \
|
python3 \
|
||||||
build-essential \
|
build-essential \
|
||||||
@@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libvips-dev \
|
libvips-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# --- BUILDER ---
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -21,28 +22,26 @@ COPY . .
|
|||||||
|
|
||||||
ENV HUSKY=0
|
ENV HUSKY=0
|
||||||
ENV CI=false
|
ENV CI=false
|
||||||
|
|
||||||
# Forzar el uso de la librería libvips del sistema y compilar desde fuente
|
|
||||||
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=0
|
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=0
|
||||||
ENV npm_config_build_from_source=true
|
ENV npm_config_build_from_source=true
|
||||||
|
|
||||||
# 1. Limpieza de cache previo y desinstalación de binarios precompilados opcionales
|
# Forzar compilación nativa sin dependencias opcionales de prebuilt
|
||||||
RUN pnpm remove -r @img/sharp-linux-x64 @img/sharp-libvips-linux-x64 || true
|
RUN pnpm install -r --config.frozen-lockfile=false
|
||||||
|
RUN pnpm rebuild sharp --build-from-source
|
||||||
|
|
||||||
# 2. Instalación ignorando scripts previos y forzando compilación explícita
|
# Compilación de la API con Turbo
|
||||||
RUN pnpm install -r --config.frozen-lockfile=false --config.build-from-source=sharp
|
|
||||||
|
|
||||||
# 3. Reconstrucción explícita del módulo usando el entorno C++ local
|
|
||||||
RUN cd apps/api && pnpm rebuild sharp
|
|
||||||
|
|
||||||
# 4. Compilación del binario de la API
|
|
||||||
RUN pnpm dlx turbo build --filter=api
|
RUN pnpm dlx turbo build --filter=api
|
||||||
|
|
||||||
|
# --- RUNNER ---
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
# Copia los archivos del builder
|
||||||
COPY --from=builder /app /app
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
|
# Re-enlace forzado en runtime para asegurar compatibilidad con la CPU host
|
||||||
|
RUN cd /app/apps/api && pnpm rebuild sharp
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["pnpm", "--filter", "api", "start"]
|
CMD ["pnpm", "--filter", "api", "start"]
|
||||||
Reference in New Issue
Block a user