-
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.
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 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,38 @@ | ||
# Use NVIDIA CUDA as base image | ||
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 | ||
|
||
# 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 libgl1 libglib2.0-0 ffmpeg curl git python3.10 python3-pip nvidia-cuda-toolkit | ||
ENV LD_LIBRARY_PATH=/usr/local/cuda/compat:$LD_LIBRARY_PATH | ||
|
||
# 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 torchvision --index-url https://download.pytorch.org/whl/cu124 | ||
RUN poetry run pip install flash-attn --no-build-isolation | ||
|
||
# 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_app_project.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,66 @@ | ||
version: '3.8' | ||
|
||
services: | ||
postgres: | ||
restart: always | ||
container_name: aana_app_project_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_app_project_app: | ||
restart: always | ||
container_name: aana_app_project_app | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
ports: | ||
- 8000:8000 # request server | ||
expose: | ||
- '8000' | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- capabilities: ["gpu"] | ||
environment: | ||
CUDA_VISIBLE_DEVICES: '${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 | ||
- hf_datasets_cache:/root/.cache/huggingface | ||
|
||
volumes: | ||
pg_data: | ||
name: aana_app_project_postgres_data | ||
app_data: | ||
name: aana_app_project_app_data | ||
hf_datasets_cache: | ||
name: hf_datasets_cache |