Spaces:
Sleeping
Sleeping
File size: 1,155 Bytes
dfa7701 0d968ea dfa7701 d0315f7 dfa7701 edf8eda dfa7701 66c7faa dfa7701 edf8eda |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# Use the latest Ubuntu image as the base
FROM ubuntu:latest
# Update the package list, install curl, and clean up to reduce image size
RUN apt-get update && \
apt-get install -y curl nginx libnginx-mod-http-lua && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Ollama using the official install script
RUN curl -fsSL https://ollama.com/install.sh | sh
# Set the Ollama host environment variable
ENV OLLAMA_HOST=0.0.0.0
# Create the Ollama directory and set permissions
RUN mkdir -p /.ollama && chmod 777 /.ollama
# Create the models directory and set permissions
RUN mkdir -p /usr/share/ollama/.ollama/models && chmod -R 777 /usr/share/ollama/.ollama/models
# Set the Ollama models environment variable
ENV OLLAMA_MODELS="/usr/share/ollama/.ollama/models"
# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Copy Lua script
COPY validate_api_key.lua /usr/local/openresty/nginx/lua/validate_api_key.lua
# Expose the Ollama server port
EXPOSE 11434
# Run the Ollama server and pull the model
CMD ollama serve & \
sleep 5 && \
ollama pull llama3 && \
wait && \
nginx -g 'daemon off;' |