mirror of
https://github.com/Sosokker/plain-rag.git
synced 2025-12-18 14:34:05 +01:00
chore: update env and readme
This commit is contained in:
parent
43f37f7ad2
commit
aec6e10f90
41
Dockerfile
41
Dockerfile
@ -1,36 +1,41 @@
|
||||
# Start with the official Python 3.12 slim-buster image.
|
||||
# slim-buster is a good choice for production as it's smaller.
|
||||
# Use optimized Python + uv base image
|
||||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
||||
|
||||
# Install the project into `/app`
|
||||
# Set work directory
|
||||
WORKDIR /app
|
||||
|
||||
# Enable bytecode compilation
|
||||
# Avoid apt prompts and enable faster install
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV UV_COMPILE_BYTECODE=1
|
||||
|
||||
# Copy from the cache instead of linking since it's a mounted volume
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
# Install the project's dependencies using the lockfile and settings
|
||||
# Install `make` with minimal overhead
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends make && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy lockfile and project config first for cache efficiency
|
||||
COPY uv.lock pyproject.toml ./
|
||||
|
||||
# Install dependencies using cache mount
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --locked --no-install-project --no-dev
|
||||
|
||||
# Then, add the rest of the project source code and install it
|
||||
# Installing separately from its dependencies allows optimal layer caching
|
||||
COPY . /app
|
||||
# Copy remaining project files
|
||||
COPY . .
|
||||
|
||||
# Install project (with cache)
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --locked --no-dev
|
||||
|
||||
# Place executables in the environment at the front of the path
|
||||
# Pre-create DB tables
|
||||
RUN make create-tables
|
||||
|
||||
# Add local venv to PATH
|
||||
ENV PATH="/app/.venv/Lib:$PATH"
|
||||
|
||||
# Reset the entrypoint, don't invoke `uv`
|
||||
# Avoid `uv` entrypoint override
|
||||
ENTRYPOINT []
|
||||
|
||||
# Command to run the application
|
||||
# Use uvicorn to run the FastAPI application.
|
||||
# --host 0.0.0.0 is required to make the app accessible from outside the container
|
||||
# --port 8000 to match the exposed port
|
||||
# Start the FastAPI app with uvicorn
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
@ -9,11 +9,14 @@ PlainRAG is RAG application without LLM orchestration frameworks like Langchain
|
||||
2. Run the following command to build and start the services:
|
||||
|
||||
```bash
|
||||
docker compose up db -d
|
||||
make install-deps # or uv sync
|
||||
make create-tables
|
||||
make start
|
||||
```
|
||||
|
||||
Then navigate to [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
|
||||
@ -19,9 +19,9 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- DB_USER=${DB_USER:-user}
|
||||
- DB_PASSWORD=${DB_PASSWORD:-password}
|
||||
- DB_NAME=${DB_NAME:-mydatabase}
|
||||
- POSTGRES_USER=${DB_USER:-user}
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD:-password}
|
||||
- POSTGRES_DB=${DB_NAME:-mydatabase}
|
||||
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
|
||||
Loading…
Reference in New Issue
Block a user