-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: add Dockerfile for base image with common dependencies and stages for different functionalities * build: add Dockerfile for base image with common dependencies and stages for different functionalities --------- Co-authored-by: 홍승우 <martin@hongseung-uui-MacBookAir.local>
- Loading branch information
Showing
5 changed files
with
83 additions
and
65 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
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,71 @@ | ||
# Base stage: Install common dependencies | ||
FROM python:3.10-slim AS base | ||
|
||
# Set working directory and environment variables | ||
WORKDIR /usr/src/app | ||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=1 | ||
|
||
# Copy only requirements files first to leverage Docker cache | ||
COPY pyproject.toml ./ | ||
|
||
# Install system and Python dependencies in a single layer | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
gcc \ | ||
libssl-dev && \ | ||
pip install --upgrade pip setuptools setuptools-scm && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /root/.cache/pip/* | ||
|
||
# Copy project files | ||
COPY . . | ||
|
||
# Install base project | ||
RUN pip install -e ./ && \ | ||
rm -rf /root/.cache/pip/* | ||
|
||
# Ko stage with minimal dependencies | ||
FROM base AS ko | ||
RUN pip install --no-cache-dir "AutoRAG[ko]" && \ | ||
rm -rf /root/.cache/pip/* | ||
ENTRYPOINT ["python", "-m", "autorag.cli"] | ||
|
||
# Dev stage with all development tools | ||
FROM base AS dev | ||
RUN pip install --no-cache-dir \ | ||
-r ./tests/requirements.txt \ | ||
-r ./docs/requirements.txt \ | ||
"AutoRAG[dev]" && \ | ||
rm -rf /root/.cache/pip/* | ||
ENTRYPOINT ["python", "-m", "autorag.cli"] | ||
|
||
# Ja stage with Japanese support | ||
FROM base AS ja | ||
RUN pip install --no-cache-dir "AutoRAG[ja]" && \ | ||
rm -rf /root/.cache/pip/* | ||
ENTRYPOINT ["python", "-m", "autorag.cli"] | ||
|
||
# API stage with minimal footprint | ||
FROM base AS api | ||
RUN rm -rf \ | ||
./sample_dataset \ | ||
./tests \ | ||
./docs \ | ||
/root/.cache/pip/* | ||
ENTRYPOINT ["python", "-m", "autorag.cli"] | ||
|
||
# Parsing stage with OCR support | ||
FROM base AS parsing | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
poppler-utils \ | ||
tesseract-ocr \ | ||
tesseract-ocr-eng \ | ||
tesseract-ocr-kor && \ | ||
pip install --no-cache-dir "AutoRAG[parse]" && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /root/.cache/pip/* | ||
ENTRYPOINT ["python", "-m", "autorag.cli"] |
File renamed without changes.
This file was deleted.
Oops, something went wrong.