-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
55 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Stihia LibreChat Proxy Dockerfile
# Multi-stage build for optimized production image
# --- Build Stage ---
FROM python:3.14-slim AS builder
WORKDIR /app
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Copy project files
COPY pyproject.toml ./
COPY uv.lock ./
COPY src ./src
# Create venv and install the package with all dependencies
ENV UV_PROJECT_ENVIRONMENT=/app/.venv
RUN uv venv $UV_PROJECT_ENVIRONMENT && \
uv sync --frozen --no-dev --no-editable --package stihia-librechat
# --- Production Stage ---
FROM python:3.14-slim
WORKDIR /app
# Install curl for health checks
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
# Copy virtual environment (includes all dependencies as proper packages)
COPY --from=builder /app/.venv /app/.venv
# Set environment variables
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Create non-root user
RUN adduser --disabled-password --gecos '' appuser && \
chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 4005
# Run with gunicorn
CMD ["gunicorn", "stihia_librechat.main:app", \
"--bind", "0.0.0.0:4005", \
"--workers", "1", \
"--worker-class", "uvicorn.workers.UvicornWorker", \
"--timeout", "300", \
"--keep-alive", "5", \
"--access-logfile", "-", \
"--error-logfile", "-"]