fix: resolve Node.js and npm installation issues
Browse files- Add proper Node.js repository setup
- Install Node.js and npm correctly
- Add yarn installation
- Add version verification
- Clean up package lists after installation
- Dockerfile +17 -7
Dockerfile
CHANGED
|
@@ -7,7 +7,20 @@ FROM python:3.10-slim-bookworm AS base
|
|
| 7 |
ARG CACHEBUST=1
|
| 8 |
ARG DEBIAN_FRONTEND=noninteractive
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN apt-get update && \
|
| 12 |
apt-get install -y --no-install-recommends \
|
| 13 |
build-essential \
|
|
@@ -24,6 +37,9 @@ RUN apt-get update && \
|
|
| 24 |
&& apt-get clean \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# Install Python dependencies
|
| 28 |
RUN pip install --no-cache-dir \
|
| 29 |
gunicorn \
|
|
@@ -52,12 +68,6 @@ RUN pip install --no-cache-dir nltk && \
|
|
| 52 |
# ============================================
|
| 53 |
FROM base AS web-builder
|
| 54 |
|
| 55 |
-
# Install Node.js and build tools
|
| 56 |
-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 57 |
-
apt-get update && \
|
| 58 |
-
apt-get install -y nodejs && \
|
| 59 |
-
npm install -g yarn
|
| 60 |
-
|
| 61 |
WORKDIR /app
|
| 62 |
|
| 63 |
# Copy web directory first
|
|
|
|
| 7 |
ARG CACHEBUST=1
|
| 8 |
ARG DEBIAN_FRONTEND=noninteractive
|
| 9 |
|
| 10 |
+
# Install Node.js and npm properly
|
| 11 |
+
RUN apt-get update && \
|
| 12 |
+
apt-get install -y --no-install-recommends \
|
| 13 |
+
curl \
|
| 14 |
+
gnupg \
|
| 15 |
+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
| 16 |
+
&& 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 \
|
| 17 |
+
&& apt-get update \
|
| 18 |
+
&& apt-get install -y nodejs \
|
| 19 |
+
&& npm install -g yarn \
|
| 20 |
+
&& apt-get clean \
|
| 21 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
+
|
| 23 |
+
# Install system dependencies
|
| 24 |
RUN apt-get update && \
|
| 25 |
apt-get install -y --no-install-recommends \
|
| 26 |
build-essential \
|
|
|
|
| 37 |
&& apt-get clean \
|
| 38 |
&& rm -rf /var/lib/apt/lists/*
|
| 39 |
|
| 40 |
+
# Verify Node.js and npm installation
|
| 41 |
+
RUN node --version && npm --version && yarn --version
|
| 42 |
+
|
| 43 |
# Install Python dependencies
|
| 44 |
RUN pip install --no-cache-dir \
|
| 45 |
gunicorn \
|
|
|
|
| 68 |
# ============================================
|
| 69 |
FROM base AS web-builder
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
WORKDIR /app
|
| 72 |
|
| 73 |
# Copy web directory first
|