AstraOS commited on
Commit
eb371f4
·
verified ·
1 Parent(s): 40665b6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -11
Dockerfile CHANGED
@@ -17,20 +17,27 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt || echo "No require
17
  # Copy application files
18
  COPY --chown=user . /app
19
 
20
- # Stage 2: Build Node.js dependencies
21
- FROM node:20-slim AS nodebuilder
22
  WORKDIR /app
23
- COPY . /app
24
- RUN npm install --production
25
 
26
- # Stage 3: Final container with both Python and Node.js
27
- FROM python:3.11-slim-bullseye
28
 
29
- # Install Node.js manually
30
- RUN apt-get update && apt-get install -y nodejs npm && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
31
 
32
- # Copy application files from previous stages
33
- COPY --from=nodebuilder /app /app
 
 
 
 
34
  WORKDIR /app
35
 
36
  # Ensure Uvicorn is installed
@@ -39,7 +46,7 @@ RUN pip install --no-cache-dir uvicorn
39
  # Expose necessary ports
40
  EXPOSE 3000 7860
41
 
42
- # Debugging: Verify Node.js and Python environments
43
  RUN node -v && npm -v && python --version && pip --version && ls -l /app
44
 
45
  # Run both services
 
17
  # Copy application files
18
  COPY --chown=user . /app
19
 
20
+ # Stage 2: Install the latest Node.js & npm via nvm
21
+ FROM python:3.11-slim-bullseye AS final
22
  WORKDIR /app
 
 
23
 
24
+ # Install required dependencies
25
+ RUN apt-get update && apt-get install -y curl bash git && rm -rf /var/lib/apt/lists/*
26
 
27
+ # Install nvm and the latest Node.js
28
+ RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash && \
29
+ export NVM_DIR="$HOME/.nvm" && \
30
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
31
+ nvm install node && \
32
+ nvm use node && \
33
+ node -v && npm -v
34
 
35
+ # Ensure Node.js is available in PATH
36
+ ENV NVM_DIR="/root/.nvm"
37
+ ENV PATH="/root/.nvm/versions/node/$(ls /root/.nvm/versions/node)/bin:$PATH"
38
+
39
+ # Copy application files
40
+ COPY --from=builder /app /app
41
  WORKDIR /app
42
 
43
  # Ensure Uvicorn is installed
 
46
  # Expose necessary ports
47
  EXPOSE 3000 7860
48
 
49
+ # Verify Node.js and Python environments before running
50
  RUN node -v && npm -v && python --version && pip --version && ls -l /app
51
 
52
  # Run both services