Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +46 -0
Dockerfile
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Start with Python 3.12 image
|
2 |
+
FROM python:3.12-slim
|
3 |
+
|
4 |
+
# Install Node.js 18.x and Supervisor
|
5 |
+
RUN apt-get update && apt-get install -y curl supervisor && \
|
6 |
+
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
7 |
+
apt-get install -y nodejs && \
|
8 |
+
apt-get clean && \
|
9 |
+
rm -rf /var/lib/apt/lists/*
|
10 |
+
|
11 |
+
# Verify installations
|
12 |
+
RUN python --version && node --version && npm --version
|
13 |
+
|
14 |
+
# Set working directory
|
15 |
+
WORKDIR /app
|
16 |
+
|
17 |
+
# Copy your application files
|
18 |
+
COPY . .
|
19 |
+
|
20 |
+
# Install any needed packages specified in requirements.txt and package.json
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
+
RUN npm install
|
23 |
+
|
24 |
+
# Create a Supervisor configuration file
|
25 |
+
RUN echo "[supervisord]\n\
|
26 |
+
nodaemon=true\n\
|
27 |
+
\n\
|
28 |
+
[program:python_server]\n\
|
29 |
+
command=python python_server.py\n\
|
30 |
+
stdout_logfile=/dev/stdout\n\
|
31 |
+
stdout_logfile_maxbytes=0\n\
|
32 |
+
stderr_logfile=/dev/stderr\n\
|
33 |
+
stderr_logfile_maxbytes=0\n\
|
34 |
+
\n\
|
35 |
+
[program:node_server]\n\
|
36 |
+
command=node node_server.js\n\
|
37 |
+
stdout_logfile=/dev/stdout\n\
|
38 |
+
stdout_logfile_maxbytes=0\n\
|
39 |
+
stderr_logfile=/dev/stderr\n\
|
40 |
+
stderr_logfile_maxbytes=0" > /etc/supervisor/conf.d/supervisord.conf
|
41 |
+
|
42 |
+
# Expose ports for both servers
|
43 |
+
EXPOSE 3000 5000
|
44 |
+
|
45 |
+
# Start Supervisor to run both servers
|
46 |
+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|