-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (51 loc) · 1.96 KB
/
Dockerfile
File metadata and controls
65 lines (51 loc) · 1.96 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Stage 1: Build environment
# Use a minimal 'base' image that only provides the essential CUDA runtime.
FROM nvidia/cuda:12.4.1-base-ubuntu22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
ENV VENV_PATH=/opt/venv
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip \
python3.10-venv \
git \
&& rm -rf /var/lib/apt/lists/* \
&& python3 -m venv $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH"
COPY src/requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools && \
pip install --no-cache-dir -r requirements.txt
#-------------------------------------------------------------------
# Install specific requirements for adapter
# Replace with your own requirements
COPY path/to/your_requirements.txt .
RUN pip install --no-cache-dir -r your_requirements.txt
#-------------------------------------------------------------------
# Stage 2: Runtime image
FROM nvidia/cuda:12.4.1-base-ubuntu22.04
# Install Python3 in the runtime stage
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
&& rm -rf /var/lib/apt/lists/*
# Set user and group ids for host user
# Override with --build-arg if needed:
# docker build --build-arg UID=1001 --build-arg GID=1001 .
ARG UID=1000
ARG GID=1000
# Add a group and user
RUN addgroup --gid $GID app && \
adduser --uid $UID --ingroup app --disabled-password --gecos '' app
# Set the working directory
WORKDIR /home/app/multinet
# Create mount points and set ownership
RUN mkdir /models /data && \
chown -R $UID:$GID /home/app/multinet /models /data
# Copy the virtual environment and source code from the builder stage
COPY --from=builder /opt/venv /opt/venv
COPY --chown=$UID:$GID src/ src/
COPY --chown=$UID:$GID scripts/ scripts/
COPY --chown=$UID:$GID definitions/ definitions/
USER app
# Set runtime environment variables
ENV PATH="/opt/venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["python3", "scripts/eval_harness/evaluate.py"]
CMD ["--help"]