File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,12 +32,17 @@ RUN apt-get update && \
3232 dpkg-reconfigure --frontend noninteractive tzdata && \
3333 apt-get clean && rm -rf /var/lib/apt/lists/*
3434
35- # Copy the project into the image
36- ADD . /app
35+ # Create a non-root user
36+ RUN useradd -m -u 1000 mmoreuser
3737
38- # Sync the project into a new environment, using the frozen lockfile
38+ # Set up working directory and permissions
39+ RUN mkdir -p /app && chown -R mmoreuser:mmoreuser /app
3940WORKDIR /app
4041
42+ # Copy the project into the image and set ownership
43+ ADD . /app
44+ RUN chown -R mmoreuser:mmoreuser /app
45+
4146# Define the build argument with a default value of an empty string (optional)
4247COPY pyproject.toml ./
4348# RUN uv sync --frozen ${UV_ARGUMENTS}
@@ -51,5 +56,7 @@ RUN uv pip install -e . --system
5156
5257ENV DASK_DISTRIBUTED__WORKER__DAEMON=False
5358
59+ USER mmoreuser
60+
5461ENTRYPOINT /bin/bash
5562
Original file line number Diff line number Diff line change @@ -80,7 +80,39 @@ sudo docker build --build-arg PLATFORM=cpu -t mmore .
8080##### Step 3: Start an interactive session
8181
8282``` bash
83- sudo docker run -it -v ./examples:/app/examples mmore
83+ sudo docker run --gpus all - it -v ./examples:/app/examples -v ./.cache:/mmoreuser/.cache mmore
8484```
8585
86+ For CPU-only platforms:
87+ ``` bash
88+ sudo docker run -it -v ./examples:/app/examples -v ./.cache:/mmoreuser/.cache mmore
89+ ```
90+
91+ > [ !WARNING]
92+ > You may need the Nvidia toolkit so the containers can access your GPUs.
93+ > Read [ this tutorial] ( https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html ) if something breaks here!
94+ >
95+ > Configure the production repository:
96+ >
97+ > ``` sh
98+ > curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
99+ > && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
100+ > sed ' s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
101+ > sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
102+ > ` ` `
103+ >
104+ > ` ` ` sh
105+ > sudo apt update
106+ > sudo apt install -y nvidia-container-toolkit
107+ > ` ` `
108+ >
109+ > Modify the Docker daemon to use Nvidia:
110+ >
111+ > ` ` ` sh
112+ > sudo nvidia-ctk runtime configure --runtime=docker
113+ > sudo systemctl restart docker
114+ > ` ` `
115+ >
116+ > You can now use ` docker run --gpus all` !
117+
86118* Note:* The ` examples` folder is mapped to ` /app/examples` inside the container, corresponding to the default path in ` examples/process/config.yaml` .
You can’t perform that action at this time.
0 commit comments