-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.cpu
More file actions
43 lines (34 loc) · 1.05 KB
/
Dockerfile.cpu
File metadata and controls
43 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.10-slim
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy application files
COPY . /app/
# Create virtual environment
RUN python3 -m venv appenv
# Activate venv and install dependencies
RUN . appenv/bin/activate && \
pip install --upgrade pip && \
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
pip install -r requirements.txt
# Install node dependencies
RUN . appenv/bin/activate && \
for node_dir in nodes/*/; do \
if [ -f "$node_dir/requirements.txt" ]; then \
pip install -r "$node_dir/requirements.txt"; \
fi \
done
# Expose port
EXPOSE 5000
# Run the application in production mode
CMD ["/app/appenv/bin/python", "-m", "pynode", "--production", "--host", "0.0.0.0", "--port", "5000"]