# FROM nvidia/cuda:12.5.1-devel-ubuntu22.04 FROM nvidia/cuda:12.6.3-devel-ubuntu22.04 # FROM julia:latest # FROM debian:latest # ------------------------------------------------------------------------------------------------ # # install required APT packages # # ------------------------------------------------------------------------------------------------ # RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y \ software-properties-common \ build-essential \ busybox \ g++ \ gcc \ wget \ net-tools \ curl \ iputils-ping \ unzip \ unixodbc \ unixodbc-dev \ libicu-dev \ nano \ libmosquitto-dev \ git \ git-lfs \ ffmpeg \ libsm6 \ libxext6 \ tar \ zip \ libssl-dev \ cmake \ ccache \ # python3 \ # python3-pip \ # python-is-python3 \ # python3-venv \ postgresql-client \ cargo \ procps # ------------------------------------------------------------------------------------------------ # # Set up folder structure # # ------------------------------------------------------------------------------------------------ # RUN mkdir /appfolder \ && mkdir /appfolder/mountvolume \ && mkdir /appfolder/app \ && mkdir /appfolder/app/temp COPY . /appfolder/app/temp RUN mv /appfolder/app/temp/env_preparation.jl /appfolder/app # ------------------------------------------------------------------------------------------------ # # Set up for Julia app # # ------------------------------------------------------------------------------------------------ # RUN mkdir /appfolder/julia WORKDIR /appfolder/julia # Option 1) install julia by downloading the tar.gz file directly # # RUN wget https://julialang-s3.julialang.org/bin/linux/x64/1.11/julia-1.11.3-linux-x86_64.tar.gz # # RUN wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.11/julia-1.11.3-linux-aarch64.tar.gz # COPY ./julia-1.11.3-linux-x86_64.tar.gz /appfolder/julia # #COPY ./julia-1.11.3-linux-aarch64.tar.gz /appfolder/julia # RUN tar zxvf julia-1.11.3-linux-x86_64.tar.gz # #RUN tar zxvf julia-1.11.3-linux-aarch64.tar.gz # RUN rm julia-1.11.3-linux-x86_64.tar.gz # #RUN rm julia-1.11.3-linux-aarch64.tar.gz # # add julia executable softlink(symlink) to usr/local/bin to be able to run julia everywhere # RUN ln -s /appfolder/julia/julia-1.11.3/bin/julia /usr/local/bin # #RUN echo "alias julia='~/julia/julia-1.11.3/bin/julia'" >> ~/.bashrc && source ~/.bashrc # Option 2) install julia by downloading the tar.gz file directly using juliaup # RUN curl -fsSL https://install.julialang.org | sh -s -- -y # SHELL ["/bin/bash", "--login" , "-c"] # ------------------------------------------------------------------------------------------------ # # Set up for webapp frontend # # ------------------------------------------------------------------------------------------------ # # # make folder path according to URL ***assuming root folder is at /appfolder/app as specified in Caddyfile*** # RUN mkdir -p /appfolder/app/hq/agent/sommelier/frontend/user # COPY . /appfolder/app/hq/agent/sommelier/frontend/user # -------------------------------------- install web server -------------------------------------- # # option 1) NGINX # RUN apt-get update && apt-get install -y nginx # COPY nginx.conf /etc/nginx/nginx.conf # # Copy your static website files to the Nginx HTML directory # COPY . /usr/share/nginx/html # option 2) Caddy # RUN apt-get update && apt-get install -y caddy # ---------------------------------------- install backend --------------------------------------- # # option 1) nodejs https://deb.nodesource.com/ # RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \ # apt-get update && apt-get install -y nodejs # ------------------------------------------------------------------------------------------------ # # install Conda as primary python environment with specified python version # # ------------------------------------------------------------------------------------------------ # # WORKDIR /appfolder/app/temp # RUN PATH="${HOME}/conda/bin:${PATH}" \ # && wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" \ # && bash Miniforge3.sh -b -p "${HOME}/conda" \ # && rm -f Miniforge3.sh \ # && source "${HOME}/conda/etc/profile.d/conda.sh" \ # && source "${HOME}/conda/etc/profile.d/mamba.sh" \ # && conda activate \ # && conda update conda -y \ # && conda install python=3.11 -y \ # && conda install pip -y \ # && pip install --trusted-host pypi.python.org -r /appfolder/app/temp/required_python_packages.txt # # && . /root/.bashrc # # add python to path to allow CMD python -m at the last line AND to be able to call python -m at linux shell # ENV PATH=/root/conda/bin:$PATH # # && CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DLLAMA_AVX2=OFF -DLLAMA_F16C=OFF -DLLAMA_FMA=OFF" FORCE_CMAKE=1 pip install llama-cpp-python --no-cache-dir # # && CMAKE_ARGS="-DLLAMA_CUBLAS=on -DLLAMA_AVX2=OFF -DLLAMA_F16C=OFF -DLLAMA_FMA=OFF" FORCE_CMAKE=1 pip install llama-cpp-python==0.2.77 --no-cache-dir # # https://github.com/abetlen/llama-cpp-python/issues/412 old CPU cause CUBLAS compile problem # ------------------------------------------------------------------------------------------------ # # install julia package for my app # # ------------------------------------------------------------------------------------------------ # WORKDIR /appfolder/app # RUN julia -t auto env_preparation.jl # ------------------------------------------------------------------------------------------------ # # install powershell # # ------------------------------------------------------------------------------------------------ # WORKDIR /appfolder/app/temp # Option 1) using .deb package # RUN wget https://github.com/PowerShell/PowerShell/releases/download/v7.5.0/powershell_7.5.0-1.deb_amd64.deb # RUN dpkg -i powershell_7.5.0-1.deb_amd64.deb # RUN apt-get install -f # Option 2) using binary package # https://learn.microsoft.com/en-us/powershell/scripting/install/install-other-linux?view=powershell-7.5 # RUN wget https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/powershell-7.5.2-linux-x64.tar.gz \ # && mkdir -p /opt/microsoft/powershell/7 \ # && tar -zxf powershell-7.5.2-linux-x64.tar.gz -C /opt/microsoft/powershell/7 \ # && chmod +x /opt/microsoft/powershell/7/pwsh \ # && ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh # ------------------------------------------------------------------------------------------------ # # remove temp folder after everything is done # # ------------------------------------------------------------------------------------------------ # WORKDIR /appfolder/app RUN rm -r /appfolder/app/temp # Make port 80 available to the world outside this container. If I use --publish at docker run command, there is no need to use EXPOSE # EXPOSE 1883 # ------------------------------------------------------------------------------------------------ # # Build llama.cpp with CUDA # # ------------------------------------------------------------------------------------------------ # WORKDIR /appfolder/mountvolume/ # clone llama.cpp repo # RUN git clone https://github.com/ggml-org/llama.cpp # build llama.cpp (change directory in the same RUN command) didn't work in Dockerfile, I need to sleep the container then get inside # to build it myself. # WORKDIR /appfolder/mountvolume/llama.cpp # RUN cmake -B build -DGGML_CUDA=ON # RUN cmake --build build --config Release -j # ------------------------------------------------------------------------------------------------ # # Run app when the container launches # # ------------------------------------------------------------------------------------------------ # WORKDIR /appfolder/app # CMD julia --project -t auto main.jl # CMD ["caddy", "run", "--config", "/appfolder/mountvolume/config/Caddyfile"] # CMD ["nginx", "-g", "daemon off;"] # CMD [ "sleep", "infinity" ] # CMD ["/appfolder/mountvolume/llama.cpp/build/bin/llama-server", "-m", "/appfolder/mountvolume/Tiel-Coder-35B-A3B-UD-IQ3_XXS.gguf", "--host", "0.0.0.0", "--port", "8080"] # CMD /appfolder/mountvolume/llama.cpp/build/bin/llama-server \ # -m /appfolder/mountvolume/$MODELFILENAME \ # $SERVERARGS CMD ["/appfolder/mountvolume/llama.cpp/build/bin/llama-server", "-m", "/appfolder/mountvolume/Tiel-Coder-35B-A3B-UD-IQ3_XXS.gguf", "--host", "0.0.0.0", "--port", "8080", "--fit-ctx", "204800", "--jinja", "--fit-target", "2048", "--cache-reuse", "256", "--temp", "1.0", "--top-k", "20", "--min-p", "0"] # CMD ["/appfolder/mountvolume/llama.cpp/build/bin/llama-server", "-m", "/appfolder/mountvolume/gemma-4-E4B-it-qat-UD-Q4_K_XL.gguf", "--mmproj", "/appfolder/mountvolume/gemma-4-E4B-it-qat-UD-Q4_K_XL-mmproj-BF16.gguf", "--jinja", "--chat-template-file", "/appfolder/mountvolume/gemma-4-E4B-chat_template.jinja", "--host", "0.0.0.0", "--port", "8080", "--fit-ctx", "131072", "--fit-target", "2048", "--cache-reuse", "256", "--temp", "1.0", "--top-k", "20", "--min-p", "0"]