From 82af967dfc4baadcc37dec9919373193b8895bfb Mon Sep 17 00:00:00 2001 From: "Ehsan.Asadi" Date: Tue, 30 Dec 2025 22:15:19 +0330 Subject: [PATCH] fix: runtime stage also uses base image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Runtime stage was installing Node.js again! Solution: Use base image for runtime too - Already has Python 3.11 ✅ - Already has Node.js 20 ✅ - Already has curl, ca-certificates ✅ - Only install tini (tiny) This is the CORRECT way to use base image! --- docker/Dockerfile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fe9192c..978b5c2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -68,9 +68,9 @@ RUN --mount=type=cache,target=/root/.npm \ npm run build # ============================================ -# Stage 2: Runtime +# Stage 2: Runtime (using base image for Node.js) # ============================================ -FROM python:3.11-slim AS runtime +FROM ${BASE_IMAGE} AS runtime LABEL org.opencontainers.image.title="Peikarband Landing" LABEL org.opencontainers.image.description="Peikarband hosting platform landing page" @@ -84,21 +84,16 @@ RUN groupadd -r peikarband && \ WORKDIR /app -# Install runtime dependencies only +# Base image already has: +# - Python 3.11 +# - Node.js 20 +# - curl, ca-certificates +# Just need to add tini for proper init RUN apt-get update && apt-get install -y --no-install-recommends \ - curl \ - ca-certificates \ tini \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean -# Install Node.js runtime -ARG NODE_VERSION=20 -RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - # Copy Python dependencies from builder COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages COPY --from=builder /usr/local/bin /usr/local/bin