1- # centOS
2- FROM nvidia/cuda:11.1.1-devel-ubi8
1+ FROM python:3.11-slim
32
4- # Enable AppStream and install Python 3.9 and git
5- RUN yum -y module enable python39 && \
6- yum install -y python39-3.9.2 && \
7- yum install -y python39-devel-3.9.2 && \
8- yum install -y git && \
9- yum clean all && \
10- (python3.9 --version || echo "Python installation failed" && exit 1)
3+ ENV PYTHONDONTWRITEBYTECODE=1 \
4+ PYTHONUNBUFFERED=1 \
5+ UV_PROJECT_ENV=/app/.venv
116
12- # Create a symbolic link to bind python to python3.9
13- RUN ln -s /usr/bin/python3.9 /usr/bin/python
7+ RUN apt-get update && apt-get install -y --no-install-recommends \
8+ build-essential \
9+ curl \
10+ git \
11+ && rm -rf /var/lib/apt/lists/*
1412
15- # Install pip (if not already included)
16- SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
17- RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python
13+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh -s -- --install-dir /usr/local/bin
1814
19- # Set working directory
2015WORKDIR /app
2116
22- # Install dependencies
23- RUN pip3 install --no-cache-dir torch==1.9.0 torchvision==0.10.0 cuda- python==11.1.1
17+ COPY pyproject.toml uv.lock ./
18+ RUN uv sync --frozen --no-dev -- python 3.11
2419
25- # Download pytorch_connectomics at specific commit (version 1.0)
26- RUN git clone https://github.com/zudi-lin/pytorch_connectomics.git /app/pytorch_connectomics && \
27- cd /app/pytorch_connectomics && \
28- git checkout 20ccfde
20+ COPY setup_pytorch_connectomics.sh ./setup_pytorch_connectomics.sh
21+ RUN chmod +x setup_pytorch_connectomics.sh && \
22+ ./setup_pytorch_connectomics.sh --force && \
23+ uv pip install --directory /app --editable /app/pytorch_connectomics && \
24+ rm -rf /app/pytorch_connectomics/.git
2925
30- COPY ./samples_pytc /app/samples_pytc
31- COPY ./ server_pytc /app /server_pytc
32- COPY ./server_api /app/server_api
26+ COPY server_api ./server_api
27+ COPY server_pytc . /server_pytc
28+ COPY scripts/docker-entrypoint.sh ./scripts/docker-entrypoint.sh
3329
34- WORKDIR /app/pytorch_connectomics
35- RUN yum install -y libglvnd-glx-1.3.2 && \
36- yum clean all && \
37- pip3 install --no-cache-dir --editable .
30+ RUN chmod +x scripts/docker-entrypoint.sh
3831
39- WORKDIR /app/server_api
40- RUN pip3 install --no-cache-dir -r requirements.txt
41-
42- WORKDIR /app
43- # Copies the startup scripts, and runs it at CMD
44- COPY ./start.sh /app/
45- COPY ./setup_pytorch_connectomics.sh /app/
46- RUN chmod +x start.sh setup_pytorch_connectomics.sh
47-
48- # Expose ports
4932EXPOSE 4242 4243 4244 6006
50- CMD [ "./start.sh" ]
33+
34+ CMD ["./scripts/docker-entrypoint.sh" ]
0 commit comments