| FROM ollama/ollama:latest |
|
|
| |
| ENV OLLAMA_HOST=0.0.0.0:7860 |
| ENV OLLAMA_PORT=7860 |
| EXPOSE 7860 |
|
|
| |
| RUN useradd -m user && chown -R user:user /home/user |
|
|
| |
| USER user |
|
|
| |
| WORKDIR /home/user/app |
|
|
| |
| USER root |
| RUN apt-get update && \ |
| apt-get install -y \ |
| curl \ |
| bash \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| USER user |
|
|
| |
| RUN mkdir -p /home/user/app/models && \ |
| ( \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/starcoder2-3b-Q2_K-GGUF/resolve/main/starcoder2-3b-q2_k.gguf -o /home/user/app/models/starcoder2.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/Qwen2-1.5B-Instruct-Q2_K-GGUF/resolve/main/qwen2-1.5b-instruct-q2_k.gguf -o /home/user/app/models/qwen2.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/gemma-2-27b-Q2_K-GGUF/resolve/main/gemma-2-27b-q2_k.gguf -o /home/user/app/models/gemma2.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/Meta-Llama-3.1-8B-Q2_K-GGUF/resolve/main/meta-llama-3.1-8b-q2_k.gguf -o /home/user/app/models/meta_llama_31.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/gemma-2-9b-it-Q2_K-GGUF/resolve/main/gemma-2-9b-it-q2_k.gguf -o /home/user/app/models/gemma2_9b.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/Phi-3-mini-128k-instruct-Q2_K-GGUF/resolve/main/phi-3-mini-128k-instruct-q2_k.gguf -o /home/user/app/models/phi3.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/Meta-Llama-3.1-8B-Instruct-Q2_K-GGUF/resolve/main/meta-llama-3.1-8b-instruct-q2_k.gguf -o /home/user/app/models/meta_llama_31_instruct.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/gpt2-xl-Q2_K-GGUF/resolve/main/gpt2-xl-q2_k.gguf -o /home/user/app/models/gpt2_xl.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/Qwen2-Math-7B-Instruct-Q2_K-GGUF/resolve/main/qwen2-math-7b-instruct-q2_k.gguf -o /home/user/app/models/qwen2_math_7b.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/WizardLM-7B-Uncensored-Q2_K-GGUF/resolve/main/wizardlm-7b-uncensored-q2_k.gguf -o /home/user/app/models/wizardlm_7b.gguf & \ |
| curl -fsSL https://huggingface.co/Ffftdtd5dtft/WizardLM-13B-Uncensored-Q2_K-GGUF/resolve/main/wizardlm-13b-uncensored-q2_k.gguf -o /home/user/app/models/wizardlm_13b.gguf & \ |
| wait \ |
| ) |
|
|
| |
| RUN echo -e 'starcoder2 -f /home/user/app/models/starcoder2.gguf\n\ |
| qwen2 -f /home/user/app/models/qwen2.gguf\n\ |
| gemma2 -f /home/user/app/models/gemma2.gguf\n\ |
| meta_llama_31 -f /home/user/app/models/meta_llama_31.gguf\n\ |
| gemma2_9b -f /home/user/app/models/gemma2_9b.gguf\n\ |
| phi3 -f /home/user/app/models/phi3.gguf\n\ |
| meta_llama_31_instruct -f /home/user/app/models/meta_llama_31_instruct.gguf\n\ |
| gpt2_xl -f /home/user/app/models/gpt2_xl.gguf\n\ |
| qwen2_math_7b -f /home/user/app/models/qwen2_math_7b.gguf\n\ |
| wizardlm_7b -f /home/user/app/models/wizardlm_7b.gguf\n\ |
| wizardlm_13b -f /home/user/app/models/wizardlm_13b.gguf' > /home/user/app/Modelfile |
|
|
| |
| RUN echo -e '#!/bin/bash\n\ |
| ollama serve &\n\ |
| sleep 5\n\ |
| while IFS= read -r line; do\n\ |
| ollama create $line\n\ |
| done < /home/user/app/Modelfile' > /home/user/app/init_models.sh && \ |
| chmod +x /home/user/app/init_models.sh |
|
|
| |
| RUN echo -e '#!/bin/bash\n\ |
| ollama serve &\n\ |
| while true; do\n\ |
| if ! pgrep -x "ollama" > /dev/null; then\n\ |
| echo "ollama no est谩 ejecut谩ndose. Reiniciando..."\n\ |
| ollama serve &\n\ |
| fi\n\ |
| sleep 10\n\ |
| done' > /home/user/app/keepalive.sh && \ |
| chmod +x /home/user/app/keepalive.sh |
|
|
| |
| RUN echo -e '#!/bin/bash\n\ |
| while true; do\n\ |
| sleep 3600\n\ |
| done' > /home/user/app/keep_running.sh && \ |
| chmod +x /home/user/app/keep_running.sh |
|
|
| |
| RUN /home/user/app/init_models.sh |
|
|
| |
| CMD ["/home/user/app/keepalive.sh"] |
|
|