omni_bot / infra /Docker /Dockerfile.cpu
WAWAA's picture
Upload folder using huggingface_hub
4962437
raw
history blame contribute delete
No virus
2.27 kB
# This is a basic Dockerfile and might need to be adjusted according to your specific application's needs. Please replace the placeholders for environment variables with your actual keys. Also, remember not to expose sensitive data like API keys in your Dockerfile or any version control systems.
# When building and running this Docker container, be sure to allocate enough resources (especially GPU memory) for your chosen visual foundation model if running on a machine with an NVIDIA GPU. You may need to use nvidia-docker or Docker's --gpus option when running the container. The GPU memory usage you provided would be valuable for this purpose.
# It's important to note that Docker inherently does not fully support GPUs. As a result, running GPU-accelerated code within Docker requires a special runtime like NVIDIA Docker. For more complex orchestration, a platform like Kubernetes can be more effective.
# Lastly, since your application seems to be using Redis (CELERY_BROKER_URL), you might need to set up a separate Redis service as well. This can be accomplished by creating a multi-container Docker application using Docker Compose or Kubernetes.
# Use an official Python runtime as a parent image
FROM python:3.10
# Set environment variables
ENV EVAL_PORT=8000 \
MODEL_NAME=gpt-4 \
CELERY_BROKER_URL=redis://localhost:6379 \
SERVER=http://localhost:${EVAL_PORT} \
USE_GPU=False \
PLAYGROUND_DIR=playground \
LOG_LEVEL=INFO \
BOT_NAME=Swarm \
# You will need to set these environment variables to your actual keys in production
OPENAI_API_KEY=your_openai_api_key \
WINEDB_HOST=your_winedb_host \
WINEDB_PASSWORD=your_winedb_password \
BING_SEARCH_URL=your_bing_search_url \
BING_SUBSCRIPTION_KEY=your_bing_subscription_key \
SERPAPI_API_KEY=your_serpapi_api_key \
REDIS_HOST=your_redis_host \
REDIS_PORT=your_redis_port
# Set work directory
WORKDIR /usr/src/app
# Add requirements file
COPY requirements.txt ./
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Bundle app source
COPY . .
# Expose port
EXPOSE ${EVAL_PORT}
# Run the application
CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "8000"]