Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +8 -7
Dockerfile
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
FROM python:3.11-slim-bullseye AS builder
|
2 |
LABEL maintainer="YourName"
|
3 |
|
@@ -16,19 +17,19 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt || echo "No require
|
|
16 |
# Copy application files
|
17 |
COPY --chown=user . /app
|
18 |
|
19 |
-
#
|
20 |
-
FROM node:20 AS nodebuilder
|
21 |
WORKDIR /app
|
22 |
COPY . /app
|
23 |
RUN npm install --production
|
24 |
|
25 |
-
# Final container
|
26 |
FROM python:3.11-slim-bullseye
|
27 |
|
28 |
# Install Node.js manually
|
29 |
RUN apt-get update && apt-get install -y nodejs npm && rm -rf /var/lib/apt/lists/*
|
30 |
|
31 |
-
# Copy application files
|
32 |
COPY --from=nodebuilder /app /app
|
33 |
WORKDIR /app
|
34 |
|
@@ -38,8 +39,8 @@ RUN pip install --no-cache-dir uvicorn
|
|
38 |
# Expose necessary ports
|
39 |
EXPOSE 3000 7860
|
40 |
|
41 |
-
# Verify
|
42 |
-
RUN ls -l /app
|
43 |
|
44 |
# Run both services
|
45 |
-
CMD ["/bin/bash", "-c", "node
|
|
|
1 |
+
# Stage 1: Build Python dependencies
|
2 |
FROM python:3.11-slim-bullseye AS builder
|
3 |
LABEL maintainer="YourName"
|
4 |
|
|
|
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 |
|
|
|
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
|
46 |
+
CMD ["/bin/bash", "-c", "node server.js & uvicorn app:app --host 0.0.0.0 --port 7860"]
|