Skip to content

Commit

Permalink
feat: add docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
YifuTao committed Sep 17, 2024
1 parent 2e0f478 commit ca1896c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UID=1000
GID=1000
SPIRES_DIR=${HOME_DIR}/oxford_spires_dataset
60 changes: 60 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ARG UBUNTU_VERSION=22.04
ARG NVIDIA_CUDA_VERSION=11.8.0

##############
# Base image #
##############
FROM nvidia/cuda:${NVIDIA_CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as base

ARG ROS_DISTRO=noetic
ARG COLMAP_VERSION=3.8
ARG CUDA_ARCHITECTURES=native
ARG HOME_DIR=/home

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
curl \
git \
python-is-python3 \
python3.10-dev \
python3-pip \
vim \
wget && \
rm -rf /var/lib/apt/lists/*

RUN python -m pip install --no-cache-dir --upgrade pip setuptools pathtools promise pybind11

####################
# Deployment image #
####################
FROM base as deploy

ARG GID
ARG UID
ENV UNAME=docker_dev
RUN addgroup --gid $GID $UNAME
RUN adduser --disabled-password --gecos '' --uid $UID --gid $GID $UNAME

ARG SPIRES_DIR=/home/docker_dev/oxford_spires_dataset
WORKDIR ${SPIRES_DIR}

COPY ./requirements.txt ${SPIRES_DIR}/requirements.txt
RUN pip install -r requirements.txt
COPY ./oxford_spires_dataset/ ${SPIRES_DIR}/oxford_spires_dataset
COPY ./pyproject.toml ${SPIRES_DIR}/pyproject.toml
RUN cd ${SPIRES_DIR}/spires_cpp && pip install -e .
RUN pip install -e .

# Make the outputs of the container match the host

RUN chown -R ${UID}:${GID} ${SPIRES_DIR}/*
USER ${UNAME}
RUN echo "PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u@docker-\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> ~/.bashrc

CMD ["/bin/bash"]
20 changes: 20 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
ndp:
container_name: spires_container
build:
context: ..
dockerfile: .docker/Dockerfile
target: deploy
args:
- USERNAME=${USER:-user}
- UID=${UID}
- GID=${GID}
environment:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
runtime: nvidia
network_mode: "host"
tty: true
volumes:
- ../scripts:${SPIRES_DIR}/scripts

0 comments on commit ca1896c

Please sign in to comment.