diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1d3726d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:20-slim AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + +# Instalar herramientas necesarias para compilar sharp desde código fuente +RUN apt-get update && apt-get install -y python3 build-essential gcc g++ make && rm -rf /var/lib/apt/lists/* + +FROM base AS builder +WORKDIR /app +COPY . . +# Forzar a sharp a ignorar binarios globales y compilar localmente +ENV SHARP_IGNORE_GLOBAL_LIBVIPS=1 +RUN pnpm install --frozen-lockfile +RUN pnpm turbo build --filter=api + +FROM base AS runner +WORKDIR /app +ENV NODE_ENV=production +COPY --from=builder /app /app + +EXPOSE 3000 +CMD ["pnpm", "--filter", "api", "start"]