Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,13 @@ FROM python:3.11-slim
# Set working directory
WORKDIR /app

# Install Node.js and npm
# Install Node.js and npm from Debian repos (avoids NodeSource TLS issues)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The PR description states that python:3.11-slim is based on Debian Trixie, but it is currently based on Debian 12 (Bookworm). Consequently, apt-get install nodejs will install Node.js v18, not v20. Since the build stage (node_builder) uses Node.js v20 and the package.json specifies @types/node": "^20", this version mismatch between build and runtime environments could lead to unexpected behavior or runtime errors. If Node.js 20 is strictly required, you may need to use a different installation method or a base image that supports it natively.

RUN apt-get update && apt-get install -y \
curl \
gnupg \
git \
ca-certificates \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
nodejs \
npm \
Comment on lines +47 to +48
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The npm package is not required in the final runtime image. The application is already built in the node_builder stage, and the start.sh script executes the application using the node binary directly (line 94). Removing npm will significantly reduce the final image size (typically by 200MB+ on Debian) and reduce the attack surface.

    nodejs \

&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down