docker name
Browse files- Dockerfile +54 -0
Dockerfile
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use NVIDIA CUDA base image
|
| 2 |
+
FROM nvidia/cuda:11.8-devel-ubuntu20.04
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Install system dependencies
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
python3.9 \
|
| 11 |
+
python3.9-dev \
|
| 12 |
+
python3-pip \
|
| 13 |
+
ffmpeg \
|
| 14 |
+
git \
|
| 15 |
+
wget \
|
| 16 |
+
curl \
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
# Create symlinks for python
|
| 20 |
+
RUN ln -s /usr/bin/python3.9 /usr/bin/python
|
| 21 |
+
|
| 22 |
+
# Set up a new user named "user" with user ID 1000
|
| 23 |
+
RUN useradd -m -u 1000 user
|
| 24 |
+
|
| 25 |
+
# Switch to the "user" user
|
| 26 |
+
USER user
|
| 27 |
+
|
| 28 |
+
# Set home to the user's home directory
|
| 29 |
+
ENV HOME=/home/user \
|
| 30 |
+
PATH=/home/user/.local/bin:$PATH
|
| 31 |
+
|
| 32 |
+
# Set the working directory to the user's home directory
|
| 33 |
+
WORKDIR $HOME/app
|
| 34 |
+
|
| 35 |
+
# Upgrade pip
|
| 36 |
+
RUN python -m pip install --no-cache-dir --upgrade pip
|
| 37 |
+
|
| 38 |
+
# Install PyTorch with CUDA support first
|
| 39 |
+
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
| 40 |
+
|
| 41 |
+
# Copy requirements file
|
| 42 |
+
COPY --chown=user requirements.txt .
|
| 43 |
+
|
| 44 |
+
# Install other Python dependencies
|
| 45 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 46 |
+
|
| 47 |
+
# Copy the application code
|
| 48 |
+
COPY --chown=user . .
|
| 49 |
+
|
| 50 |
+
# Expose the port
|
| 51 |
+
EXPOSE 7860
|
| 52 |
+
|
| 53 |
+
# Run the application
|
| 54 |
+
CMD ["python", "unified_socket_server.py", "--host", "0.0.0.0", "--port", "7860"]
|