From f1063a7042af0660c5a917d69d2018787ee17ddf Mon Sep 17 00:00:00 2001 From: Yutaro Koike Date: Mon, 19 May 2025 14:50:48 +0900 Subject: [PATCH 1/6] add compose.yaml for docker compose --- compose.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 compose.yaml diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000000..cd445fa5e1 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,17 @@ +services: + nerfstudio: + build: + context: . + dockerfile: Dockerfile + shm_size: 12gb + ports: + - 7007:7007 + volumes: + - ./workspace:/workspace/ + - ./cache:/home/user/.cache/ + deploy: + resources: + reservations: + devices: + - driver: nvidia + capabilities: [gpu] \ No newline at end of file From c20c914682360840985b339aea86d17c2f7ccf79 Mon Sep 17 00:00:00 2001 From: Yutaro Koike Date: Mon, 19 May 2025 14:51:14 +0900 Subject: [PATCH 2/6] rm format warning on Dockerfile --- Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6cd4e058f0..6e46f74d1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,15 @@ ARG CUDA_ARCHITECTURES="90;89;86;80;75;70;61" ARG NERFSTUDIO_VERSION="" # Pull source either provided or from git. -FROM scratch as source_copy +FROM scratch AS source_copy ONBUILD COPY . /tmp/nerfstudio -FROM alpine/git as source_no_copy +FROM alpine/git AS source_no_copy ARG NERFSTUDIO_VERSION ONBUILD RUN git clone --branch ${NERFSTUDIO_VERSION} --recursive https://github.com/nerfstudio-project/nerfstudio.git /tmp/nerfstudio ARG NERFSTUDIO_VERSION -FROM source_${NERFSTUDIO_VERSION:+no_}copy as source +FROM source_${NERFSTUDIO_VERSION:+no_}copy AS source -FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as builder +FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} AS builder ARG CUDA_ARCHITECTURES ARG NVIDIA_CUDA_VERSION ARG UBUNTU_VERSION @@ -109,15 +109,15 @@ RUN chmod -R go=u /usr/local/lib/python3.10 && \ # # Docker runtime stage. # -FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} as runtime +FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION} AS runtime ARG CUDA_ARCHITECTURES ARG NVIDIA_CUDA_VERSION ARG UBUNTU_VERSION -LABEL org.opencontainers.image.source = "https://github.com/nerfstudio-project/nerfstudio" -LABEL org.opencontainers.image.licenses = "Apache License 2.0" +LABEL org.opencontainers.image.source="https://github.com/nerfstudio-project/nerfstudio" +LABEL org.opencontainers.image.licenses="Apache License 2.0" LABEL org.opencontainers.image.base.name="docker.io/library/nvidia/cuda:${NVIDIA_CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}" -LABEL org.opencontainers.image.documentation = "https://docs.nerf.studio/" +LABEL org.opencontainers.image.documentation="https://docs.nerf.studio/" # Minimal dependencies to run COLMAP binary compiled in the builder stage. # Note: this reduces the size of the final image considerably, since all the @@ -152,4 +152,4 @@ COPY --from=builder /usr/local/bin/ns* /usr/local/bin/ RUN /bin/bash -c 'ns-install-cli --mode install' # Bash as default entrypoint. -CMD /bin/bash -l +CMD ["/bin/bash", "-l"] From 556c0142282d777747e6f6e469aa82aee038626e Mon Sep 17 00:00:00 2001 From: yt-koike <42059282+yt-koike@users.noreply.github.com> Date: Tue, 20 May 2025 10:58:41 +0900 Subject: [PATCH 3/6] Update compose.yaml --- compose.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index cd445fa5e1..6d83e5af7d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,5 +1,7 @@ services: nerfstudio: + #image: ghcr.io/nerfstudio-project/nerfstudio:latest + # If you want to build from the source code, please delete image: directive and use the build: directive following build: context: . dockerfile: Dockerfile @@ -9,9 +11,11 @@ services: volumes: - ./workspace:/workspace/ - ./cache:/home/user/.cache/ + stdin_open: true + tty: true deploy: resources: reservations: devices: - driver: nvidia - capabilities: [gpu] \ No newline at end of file + capabilities: [gpu] From 817bbd332377a4157cf11cd05548b6b774115dc0 Mon Sep 17 00:00:00 2001 From: yt-koike <42059282+yt-koike@users.noreply.github.com> Date: Tue, 20 May 2025 11:10:23 +0900 Subject: [PATCH 4/6] Update installation.md --- docs/quickstart/installation.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/quickstart/installation.md b/docs/quickstart/installation.md index de79064213..723840f95f 100644 --- a/docs/quickstart/installation.md +++ b/docs/quickstart/installation.md @@ -263,6 +263,16 @@ docker run --gpus all \ # Give the conta nerfstudio # Docker image tag if you built the image from the Dockerfile by yourself using the command from above. ``` +You can also start an interactive terminal with [docker compose](https://docs.docker.com/compose/) by taking the following steps. + +``` +docker compose up -d # Start the server +docker compose exec nerfstudio bash # Start the shell +docker compose down # Stop the server +``` + +Docker compose fetches the image from the Internet by default. If you want to build it from the source code, please edit compose.yaml and restart the server. + ### Call nerfstudio commands directly Besides, the container can also directly be used by adding the nerfstudio command to the end. From 62ef9ba4321f054e5233168333baa372a6538554 Mon Sep 17 00:00:00 2001 From: yt-koike <42059282+yt-koike@users.noreply.github.com> Date: Tue, 20 May 2025 11:11:01 +0900 Subject: [PATCH 5/6] add hostname --- compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/compose.yaml b/compose.yaml index 6d83e5af7d..b5563cbc4b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -5,6 +5,7 @@ services: build: context: . dockerfile: Dockerfile + hostname: nerfstudio shm_size: 12gb ports: - 7007:7007 From f78d846d4b13f023136615f1c37103a03560f929 Mon Sep 17 00:00:00 2001 From: yt-koike <42059282+yt-koike@users.noreply.github.com> Date: Tue, 20 May 2025 11:13:20 +0900 Subject: [PATCH 6/6] Update installation.md --- docs/quickstart/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart/installation.md b/docs/quickstart/installation.md index 723840f95f..70b1626840 100644 --- a/docs/quickstart/installation.md +++ b/docs/quickstart/installation.md @@ -271,7 +271,7 @@ docker compose exec nerfstudio bash # Start the shell docker compose down # Stop the server ``` -Docker compose fetches the image from the Internet by default. If you want to build it from the source code, please edit compose.yaml and restart the server. +Docker compose fetches the latest image from the Internet by default. If you want to build it from the source code or apply custom settings, please edit compose.yaml and restart the server. ### Call nerfstudio commands directly