Nuevo ajuste en el DockerFile Sharp

This commit is contained in:
2026-08-21 01:39:33 +00:00
parent 72c3356c05
commit 77c973eccc

View File

@@ -3,18 +3,25 @@ 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
# Herramientas esenciales para compilar sharp desde fuente en el host actual # Instalamos las herramientas de compilación Y libvips para compilación nativa limpia
RUN apt-get update && apt-get install -y python3 build-essential gcc g++ make libc-dev && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y \
python3 \
build-essential \
gcc \
g++ \
make \
libc-dev \
libvips-dev \
&& rm -rf /var/lib/apt/lists/*
FROM base AS builder FROM base AS builder
WORKDIR /app WORKDIR /app
COPY . . COPY . .
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=1 # 1. Indicamos a sharp que NO use sus binarios precompilados y fuerce la compilación desde código fuente
RUN pnpm config set supportedArchitectures.os linux ENV SHARP_IGNORE_GLOBAL_LIBVIPS=0
RUN pnpm config set supportedArchitectures.cpu x64 ENV npm_config_build_from_source=true
RUN pnpm config set supportedArchitectures.libc glibc
ENV CI=false ENV CI=false
RUN pnpm install -w --config.frozen-lockfile=false RUN pnpm install -w --config.frozen-lockfile=false
@@ -24,6 +31,7 @@ RUN pnpm dlx turbo build --filter=api
FROM base AS runner FROM base AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=builder /app /app COPY --from=builder /app /app
EXPOSE 3000 EXPOSE 3000