Aura_AI_Scan / Dockerfile
Artyom Boyko
Replacing the OS to Ubuntu 24.04 and fixing the current results.
a8de063
raw
history blame
2.18 kB
FROM ubuntu:latest
# ENV PIP_ROOT_USER_ACTION=ignore
ARG USERNAME=mcp_user
ARG USER_UID=1000
ARG APP_WORKDIR=app_srv
WORKDIR /tmp/
COPY requirements.txt packages.txt ./
RUN apt-get -y update && apt-get -y upgrade && xargs apt -y install < packages.txt
# Install CUDA 12.8
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb \
&& dpkg -i cuda-keyring_1.1-1_all.deb \
&& apt-get update \
&& apt-get -y install cuda-toolkit-12-8
# https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#post-installation-actions
ENV PATH=/usr/local/cuda-12.8/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/local/cuda-12.8/lib64:/usr/lib/x86_64-linux-gnu/
# Install cuDNN for CUDA 12
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb \
&& dpkg -i cuda-keyring_1.1-1_all.deb \
&& apt-get update \
&& apt-get -y install cudnn-cuda-12
# Remove EXTERNALLY-MANAGED
RUN rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED
# Install Pytorch for CUDA 12.8
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
# Install other python packages
# RUN rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED
RUN pip3 install --no-cache-dir -r requirements.txt
# Clear after build image
RUN apt-get clean
RUN rm -rf /tmp/*
# Delet exist user with UID 1000
RUN userdel -r ubuntu || true
# https://huggingface.co/docs/hub/spaces-sdks-docker#permissions
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u $USER_UID $USERNAME
# Switch to the "user" user
USER $USERNAME
# Set home to the user's home directory
ENV HOME=/home/$USERNAME \
PATH=/home/$USERNAME/.local/bin:$PATH
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
RUN mkdir -p $HOME/$APP_WORKDIR
COPY --chown=$USERNAME ./$APP_WORKDIR/* $HOME/$APP_WORKDIR
# Set the working directory to the user's home directory
WORKDIR $HOME/$APP_WORKDIR
# Gradio configuration
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["python", "app_srv.py"]