generated from mobiusml/aana_app_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mobiusml/docker_config
Add docker config
- Loading branch information
Showing
5 changed files
with
8,134 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Use NVIDIA CUDA as base image | ||
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 | ||
|
||
# Build args | ||
ARG INSTALL_FLASH_ATTENTION=false | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Set environment variables to non-interactive (this prevents some prompts) | ||
ENV DEBIAN_FRONTEND=non-interactive | ||
|
||
# Install required libraries, tools, and Python3 | ||
RUN apt-get update && apt-get install -y ffmpeg curl git python3.10 python3-pip | ||
|
||
# Install poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# Update PATH | ||
RUN echo 'export PATH="/root/.local/bin:$PATH"' >> /root/.bashrc | ||
ENV PATH="/root/.local/bin:$PATH" | ||
|
||
# Copy project files into the container | ||
COPY . /app | ||
|
||
# Install the package with poetry | ||
RUN poetry install | ||
|
||
# Install flash attention | ||
RUN poetry run pip install torch --index-url https://download.pytorch.org/whl/cu121 | ||
RUN if [[ "$INSTALL_FLASH_ATTENTION" = "true" ]] ; then \ | ||
poetry run pip install flash-attn --no-build-isolation; \ | ||
else \ | ||
echo Skip flash_atten installation ; \ | ||
fi | ||
|
||
# Disable buffering for stdout and stderr to get the logs in real time | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Expose the desired port | ||
EXPOSE 8000 | ||
|
||
# Run the app | ||
CMD ["poetry", "run", "aana", "deploy", "aana_chat_with_video.app:aana_app", "--host", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgres: | ||
restart: always | ||
container_name: aana_chat_with_video_db | ||
image: postgres | ||
command: postgres -c 'max_connections=1000' | ||
healthcheck: | ||
test: /usr/bin/pg_isready | ||
timeout: 45s | ||
interval: 10s | ||
retries: 10 | ||
ports: | ||
- '15430:15430' | ||
expose: | ||
- 15430 | ||
environment: | ||
PGPASSWORD: '${POSTGRES_PASSWORD:-Yf?5nX39}' | ||
PGUSER: '${POSTGRES_USER:-aana_db_user}' | ||
PGDATABASE: '${POSTGRES_DB:-aana_db}' | ||
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD:-Yf?5nX39}' | ||
POSTGRES_USER: '${POSTGRES_USER:-aana_db_user}' | ||
POSTGRES_DB: '${POSTGRES_DB:-aana_db}' | ||
PGPORT: '15430' | ||
PGDATA: '/pgdata' | ||
volumes: | ||
- pg_data:/pgdata | ||
|
||
aana_chat_with_video_app: | ||
restart: always | ||
container_name: aana_chat_with_video_app | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
ports: | ||
- 8000:8000 # request server | ||
expose: | ||
- '8000' | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
INSTALL_FLASH_ATTENTION: '${INSTALL_FLASH_ATTENTION:-false}' | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- capabilities: ["gpu"] | ||
environment: | ||
CUDA_VISIBLE_DEVICES: | ||
HF_HUB_ENABLE_HF_TRANSFER: '${HF_HUB_ENABLE_HF_TRANSFER:-1}' | ||
HF_TOKEN: '${HF_TOKEN}' | ||
HF_DATASETS_CACHE: /root/.cache/huggingface | ||
NUM_WORKERS: '${NUM_WORKERS:-2}' | ||
TMP_DATA_DIR: /tmp/aana_data | ||
DB_CONFIG: '{"datastore_type":"postgresql","datastore_config":{"host":"postgres","port":"15430","user":"${POSTGRES_USER:-aana_db_user}","password":"${POSTGRES_PASSWORD:-Yf?5nX39}","database":"${POSTGRES_DB:-aana_db}"}}' | ||
volumes: | ||
- app_data:/tmp/aana_data | ||
- hf_datasets_cache:/root/.cache/huggingface | ||
|
||
volumes: | ||
pg_data: | ||
name: aana_chat_with_video_postgres_data | ||
app_data: | ||
name: aana_chat_with_video_app_data | ||
hf_datasets_cache: | ||
name: hf_datasets_cache |
Oops, something went wrong.