DI-sheep / Dockerfile
zjowowen's picture
Update Dockerfile
293f0b6
FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-runtime as base
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:UTF-8
ENV LC_ALL en_US.UTF-8
RUN apt update -y \
&& apt install libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender-dev swig curl git vim gcc \g++ make wget locales dnsutils zip unzip cmake nginx -y \
&& curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g [email protected] \
&& npm install -g create-react-app \
&& npm install typescript -g \
&& npm install -g vite \
&& apt clean \
&& rm -rf /var/cache/apt/* \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
ADD nginx.conf /etc/nginx/nginx.conf
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
RUN mkdir -p /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx
RUN touch /var/run/nginx.pid
RUN touch /run/nginx.pid
RUN chown -R user:user /var/cache/nginx \
/var/log/nginx \
/var/lib/nginx \
/var/run/nginx.pid \
/run/nginx.pid
# 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
WORKDIR $HOME/workspace
ADD --chown=user DI-sheep DI-sheep
ADD --chown=user run.sh run.sh
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install --no-cache-dir DI-engine \
&& python3 -m pip install --no-cache-dir -r ./DI-sheep/service/requirement.txt
RUN cd ./DI-sheep/ui/ \
&& npm install react react-dom @types/react @types/react-dom \
&& npm audit fix \
&& npm run build
RUN cd $HOME/workspace \
&& chmod 777 run.sh
EXPOSE 4173
EXPOSE 5000
EXPOSE 5002
CMD sh ./run.sh