Nuevo ajuste en el DockerFile Sharp
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -3,18 +3,25 @@ ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
# Herramientas esenciales para compilar sharp desde fuente en el host actual
|
||||
RUN apt-get update && apt-get install -y python3 build-essential gcc g++ make libc-dev && rm -rf /var/lib/apt/lists/*
|
||||
# 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 \
|
||||
libvips-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=1
|
||||
RUN pnpm config set supportedArchitectures.os linux
|
||||
RUN pnpm config set supportedArchitectures.cpu x64
|
||||
RUN pnpm config set supportedArchitectures.libc glibc
|
||||
# 1. Indicamos a sharp que NO use sus binarios precompilados y fuerce la compilación desde código fuente
|
||||
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=0
|
||||
ENV npm_config_build_from_source=true
|
||||
|
||||
ENV CI=false
|
||||
RUN pnpm install -w --config.frozen-lockfile=false
|
||||
@@ -24,6 +31,7 @@ RUN pnpm dlx turbo build --filter=api
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app /app
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
Reference in New Issue
Block a user