fix(Dockerfile): migrate docker image repo to nvcr.io/nvidia/driver (#51)

This commit is contained in:
Xuehai Pan 2022-12-13 17:49:17 +08:00 committed by GitHub
parent c04fbb9bbc
commit 13e70aa70a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 7 deletions

View file

@ -11,6 +11,7 @@ on:
- pyproject.toml
- MANIFEST.in
- nvitop/version.py
- Dockerfile
- .github/workflows/build.yaml
release:
types:
@ -78,6 +79,11 @@ jobs:
python -m pre_commit run --all-files
)
- name: Test docker build
run: |
docker build --tag nvitop:latest .
docker run --rm nvitop:latest --help
- name: Set __release__
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: |

View file

@ -1,6 +1,7 @@
ARG basetag="418.87.01-ubuntu18.04" # Ubuntu only
FROM nvidia/driver:"${basetag}"
ARG basetag="450-signed-ubuntu22.04" # Ubuntu only
FROM nvcr.io/nvidia/driver:"${basetag}"
ENV NVIDIA_DISABLE_REQUIRE=true
ENV DEBIAN_FRONTEND=noninteractive
# Update APT sources
@ -11,19 +12,27 @@ RUN . /etc/os-release && [ "${NAME}" = "Ubuntu" ] && \
# Install Python 3
RUN apt-get update && \
apt-get install --quiet --yes --no-install-recommends \
python3-dev python3-pip python3-setuptools python3-wheel locales && \
apt-get install --quiet --yes --no-install-recommends python3-dev python3-venv locales && \
rm -rf /var/lib/apt/lists/*
# Setup locale
ENV LC_ALL=C.UTF-8
RUN update-locale LC_ALL="C.UTF-8"
# Setup environment
RUN python3 -m venv /venv && \
. /venv/bin/activate && \
python3 -m pip install --upgrade pip setuptools && \
rm -rf /root/.cache && \
echo && echo && echo "source /venv/bin/activate" >> /root/.bashrc
ENV SHELL /bin/bash
# Install nvitop
COPY . /nvitop
WORKDIR /nvitop
RUN pip3 install --compile . && \
RUN . /venv/bin/activate && \
python3 -m pip install . && \
rm -rf /root/.cache
# Entrypoint
ENTRYPOINT [ "python3", "-m", "nvitop" ]
ENTRYPOINT [ "/venv/bin/python3", "-m", "nvitop" ]

View file

@ -276,7 +276,7 @@ docker build --tag nvitop:latest . # build the Docker image
docker run -it --rm --runtime=nvidia --gpus=all --pid=host nvitop:latest # run the Docker container
```
The [`Dockerfile`](Dockerfile) has a optional build argument `basetag` (default: `418.87.01-ubuntu18.04`) for the tag of image [`nvidia/driver`](https://hub.docker.com/r/nvidia/driver/tags).
The [`Dockerfile`](Dockerfile) has a optional build argument `basetag` (default: `450-signed-ubuntu22.04`) for the tag of image [`nvcr.io/nvidia/driver`](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/driver/tags).
**NOTE:** Don't forget to add the `--pid=host` option when running the container.