Update Dockerfile
Browse files- Dockerfile +21 -26
Dockerfile
CHANGED
@@ -25,9 +25,8 @@ ENV HOME=/home/user \
|
|
25 |
# Set the working directory to the user's home directory
|
26 |
WORKDIR $HOME/app
|
27 |
|
28 |
-
# Install
|
29 |
USER root
|
30 |
-
# Install basic utilities, Python 3.9, graphical libraries, and add NVIDIA cuDNN repository
|
31 |
RUN apt-get update && apt-get install -y \
|
32 |
wget \
|
33 |
curl \
|
@@ -36,34 +35,30 @@ RUN apt-get update && apt-get install -y \
|
|
36 |
gnupg \
|
37 |
libgl1-mesa-glx \
|
38 |
libglib2.0-0 \
|
39 |
-
&&
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
&&
|
45 |
-
&&
|
46 |
-
&& update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip 1 \
|
47 |
-
&& curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg && \
|
48 |
-
echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" > /etc/apt/sources.list.d/cuda.list && \
|
49 |
-
apt-get update && apt-get install -y \
|
50 |
-
libcudnn8=8.9.3.0-1+cuda11.8 \
|
51 |
-
libcudnn8-dev=8.9.3.0-1+cuda11.8 \
|
52 |
-
libcudnn8-doc=8.9.3.0-1+cuda11.8 \
|
53 |
&& rm -rf /var/lib/apt/lists/*
|
54 |
|
55 |
-
# Verify
|
56 |
-
RUN
|
57 |
-
|
58 |
-
|
59 |
-
RUN python --version && pip --version
|
60 |
|
61 |
USER user
|
62 |
-
#
|
|
|
|
|
|
|
|
|
63 |
COPY . .
|
64 |
-
RUN pip install --upgrade pip
|
65 |
-
RUN pip install -r requirements.txt
|
66 |
-
RUN pip install gradio
|
67 |
|
68 |
USER root
|
69 |
# Configure git to trust the directory
|
@@ -77,4 +72,4 @@ ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
|
77 |
ENV CUDA_VISIBLE_DEVICES=0
|
78 |
|
79 |
# Command to run your application
|
80 |
-
CMD ["python", "app.py"]
|
|
|
25 |
# Set the working directory to the user's home directory
|
26 |
WORKDIR $HOME/app
|
27 |
|
28 |
+
# Install Conda and create the environment
|
29 |
USER root
|
|
|
30 |
RUN apt-get update && apt-get install -y \
|
31 |
wget \
|
32 |
curl \
|
|
|
35 |
gnupg \
|
36 |
libgl1-mesa-glx \
|
37 |
libglib2.0-0 \
|
38 |
+
&& wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \
|
39 |
+
&& bash miniconda.sh -b -p /opt/conda \
|
40 |
+
&& rm miniconda.sh \
|
41 |
+
&& /opt/conda/bin/conda init bash \
|
42 |
+
&& /opt/conda/bin/conda update -n base -c defaults conda \
|
43 |
+
&& /opt/conda/bin/conda install -y -c conda-forge mamba \
|
44 |
+
&& /opt/conda/bin/mamba install -c nvidia -c pytorch -c conda-forge -c defaults python=3.9 pytorch=2.5.1 torchvision=0.20.1 torchaudio=2.5.1 pytorch-cuda=11.8 timm scikit-learn matplotlib pandas \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
&& rm -rf /var/lib/apt/lists/*
|
46 |
|
47 |
+
# Verify installation
|
48 |
+
RUN /opt/conda/bin/conda --version
|
49 |
+
RUN /opt/conda/bin/python --version
|
50 |
+
RUN /opt/conda/bin/python -c "import torch; print(torch.__version__)"
|
|
|
51 |
|
52 |
USER user
|
53 |
+
# Create the environment and activate it
|
54 |
+
RUN /opt/conda/bin/conda env create -f /home/user/app/environment.yaml
|
55 |
+
RUN echo "conda activate gazelle" >> ~/.bashrc
|
56 |
+
|
57 |
+
# Install additional Python dependencies
|
58 |
COPY . .
|
59 |
+
RUN /opt/conda/bin/pip install --upgrade pip
|
60 |
+
RUN /opt/conda/bin/pip install -r requirements.txt
|
61 |
+
RUN /opt/conda/bin/pip install gradio
|
62 |
|
63 |
USER root
|
64 |
# Configure git to trust the directory
|
|
|
72 |
ENV CUDA_VISIBLE_DEVICES=0
|
73 |
|
74 |
# Command to run your application
|
75 |
+
CMD ["/opt/conda/bin/python", "app.py"]
|