ollama-server / Dockerfile
Yaya86's picture
Update Dockerfile
07f4eb8 verified
raw
history blame
9.11 kB
# Builder stage
FROM ubuntu:latest
RUN apt update && apt install curl -y
RUN curl -fsSL https://ollama.com/install.sh | sh
ENV OLLAMA_HOST=0.0.0.0
RUN useradd -m -u 1000 appuser
#&& chown -R appuser:appuser /home/appuser
# Create the directory and give appropriate permissions
#RUN mkdir -p /.ollama && chmod 777 /.ollama
#RUN mkdir -p /home/appuser/.ollama && chmod 777 /home/appuser/.ollama
#RUN mkdir -p /home/appuser/.ollama/models &&
#USER appuser
#WORKDIR /.ollama
#Copy fichiers blobs
RUN mkdir /usr/share/ollama/.ollama/models && chmod 777 usr/share/ollama/.ollama/models
RUN mkdir /usr/share/ollama/.ollama/models/blobs && chmod 777 /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser alfred_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser command_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser dolphi-phi_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser falcon_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser gemma_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser llama2_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser meditron_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser medllama_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mistral_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mistrallite_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser openchat_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser stablelm2_erbot/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mxbai-embed-large/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser openchat_story/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mistral_story/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mistrallite_story/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser all-minilm/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser nomic-embed-text/blobs /usr/share/ollama/.ollama/models/blobs
COPY --chown=appuser mixtral_erbot/blobs /usr/share/ollama/.ollama/models/blobs
#Création des dossier pour recevoir les fichiers latest
RUN mkdir /usr/share/ollama/.ollama/models/manifest && chmod 777 usr/share/ollama/.ollama/models/manifest
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/alfred_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/alfred_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/command_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/command_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/dolphi-phi_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/dophi-phi_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/falcon_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/falcon_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/gemma_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/gemma_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/llama2_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/llama2_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/meditron_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/meditron_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/medllama_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/medllama_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/stablelm2_erbot && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/stablelm2_erbot
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mxbai-embed-large && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mxbai-embed-large
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_story && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_story
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_story && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_story
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_story && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_story
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/all_minilm && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/all-minilm
RUN mkdir /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/nomic-embed-text && chmod 777 /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/nomic-embed-text
#Copy des fichiers latest
COPY --chown=appuser alfred_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/alfred_erbot
COPY --chown=appuser command_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/command_erbot
COPY --chown=appuser dolphi-phi_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/dolphi-phi_erbot
COPY --chown=appuser falcon_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/falcon_erbot
COPY --chown=appuser gemma_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/gemma_erbot
COPY --chown=appuser llama2_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/llama2_erbot
COPY --chown=appuser meditron_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/meditron_erbot
COPY --chown=appuser medllama_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/medllama_erbot
COPY --chown=appuser mistral_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_erbot
COPY --chown=appuser mistrallite_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_erbot
COPY --chown=appuser openchat_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_erbot
COPY --chown=appuser stablelm2_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/stablelm2_erbot
COPY --chown=appuser mxbai-embed-large/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mxbai-embed-large
COPY --chown=appuser openchat_story/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/openchat_story
COPY --chown=appuser mistral_story/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_story
COPY --chown=appuser mistrallite_story/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistrallite_story
COPY --chown=appuser all-minilm/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/all-minilm
COPY --chown=appuser nomic-embed-text/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/nomic-embed-text
COPY --chown=appuser mixtral_erbot/latest /usr/share/ollama/.ollama/models/manifest/registry.ollama.ai/library/mistral_erbot
#COPY --chown=appuser models /usr/share/ollama/.ollama/models
#RUN chmod 777 /home/appuser/.ollama/models
# Copy the entry point script
#COPY --chown=appuser entrypoint.sh /entrypoint.sh
#RUN chmod +x /entrypoint.sh
# Set the entry point script as the default command
#ENTRYPOINT ["/entrypoint.sh"]
CMD ["ollama", "serve"]
# Set the model as an environment variable (this can be overridden)
#ENV model="nomic-embed-text","yayarun/mixtral_erbot"
ENV OLLAMA_MODELS="/usr/share/ollama/.ollama/models"
# Expose the server port
EXPOSE 7860