One-2-3-45 / Dockerfile
chaoxu's picture
user bug fix
fb26fe0
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
git-lfs \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
python3-dev \
cmake \
unzip \
vim \
ffmpeg \
curl \
wget \
libgl1-mesa-glx \
libglib2.0-0 \
build-essential \
libsparsehash-dev \
&& rm -rf /var/lib/apt/lists/*
# Set Python3 as the default version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN pip3 install --upgrade pip
# Install PyTorch
RUN pip3 install --no-cache-dir \
torch \
torchvision \
torchaudio \
--index-url https://download.pytorch.org/whl/cu118
COPY requirements.txt /opt/app/requirements.txt
WORKDIR /opt/app
RUN pip install -r requirements.txt
# COPY . /opt/app
COPY requirements.txt /opt/app
ARG TORCH_CUDA_ARCH_LIST="5.2;7.0;7.2;8.0;8.6+PTX"
ARG IABN_FORCE_CUDA="1"
ARG FORCE_CUDA="1"
RUN pip3 install --no-cache-dir \
inplace_abn \
git+https://github.com/mit-han-lab/torchsparse.git@v1.4.0
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
SYSTEM=spaces
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
CMD ["python3", "app.py"]