Create Dockerfile
Browse files- Dockerfile +53 -0
Dockerfile
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official PyTorch 2.0.1 image as a base
|
2 |
+
FROM pytorch/pytorch:2.0.1-cuda11.1-cudnn8-runtime
|
3 |
+
|
4 |
+
# Install Git and system libraries required for OpenGL without interactive prompts
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
+
|
7 |
+
# Install Git, OpenGL libraries, and libglib2.0
|
8 |
+
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
9 |
+
|
10 |
+
# Set the pip resolver to "legacy"
|
11 |
+
RUN pip config set global.resolver legacy
|
12 |
+
|
13 |
+
RUN apt-get update && apt-get install -y ninja-build
|
14 |
+
|
15 |
+
# Set up a new user named "user" with user ID 1000
|
16 |
+
RUN useradd -m -u 1000 user
|
17 |
+
# Switch to the "user" user
|
18 |
+
USER user
|
19 |
+
# Set environment variables
|
20 |
+
ENV HOME=/home/user \
|
21 |
+
CUDA_HOME=/usr/local/cuda \
|
22 |
+
PATH=/home/user/.local/bin:$PATH \
|
23 |
+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
|
24 |
+
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
|
25 |
+
PYTHONPATH=$HOME/app \
|
26 |
+
PYTHONUNBUFFERED=1 \
|
27 |
+
GRADIO_ALLOW_FLAGGING=never \
|
28 |
+
GRADIO_NUM_PORTS=1 \
|
29 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
30 |
+
GRADIO_THEME=huggingface \
|
31 |
+
GRADIO_SHARE=False \
|
32 |
+
SYSTEM=spaces
|
33 |
+
|
34 |
+
# Set the working directory to the user's home directory
|
35 |
+
WORKDIR $HOME/app
|
36 |
+
|
37 |
+
COPY . .
|
38 |
+
|
39 |
+
# Install dependencies
|
40 |
+
#COPY requirements.txt $HOME/app/requirements.txt
|
41 |
+
RUN pip install --no-cache-dir -r requirements.txt gradio
|
42 |
+
|
43 |
+
|
44 |
+
# Update package lists and install other dependencies as needed
|
45 |
+
# Ensure that CUDA components are correctly installed and configured
|
46 |
+
# Install any other required packages
|
47 |
+
|
48 |
+
# Set the environment variable to specify the GPU device
|
49 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
50 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
51 |
+
|
52 |
+
# Run your app.py script
|
53 |
+
CMD ["python", "app.py"]
|