diff --git a/Dockerfile b/Dockerfile index a2dfc4b..3ce7806 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,41 @@ -# ── Build ── -FROM python:3.12-slim AS builder +FROM python:3.14-alpine3.23 AS builder + +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +ENV UV_LINK_MODE=copy WORKDIR /app -COPY . . -RUN pip install --no-cache-dir uv && \ - uv build --wheel +RUN --mount=type=cache,target=/root/.cache/uv \ + --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ + uv sync --all-extras --no-install-project --no-dev + +COPY pyproject.toml LICENSE README.md ./ +COPY src/ ./src/ + +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --all-extras --no-dev + -# ── Runtime ── -FROM python:3.12-slim +FROM python:3.14-alpine3.23 +LABEL org.opencontainers.image.description="CLI tool for syncing content to Open WebUI Knowledge Bases" \ + org.opencontainers.image.source="https://github.com/open-webui/oikb" \ + org.opencontainers.image.vendor="Open WebUI Inc." \ + org.opencontainers.image.licenses="MIT" +ENV PYTHONUNBUFFERED=1 + +RUN apk add --no-cache ca-certificates \ + && addgroup -g 1000 appuser \ + && adduser -D -u 1000 -G appuser appuser + +COPY --from=builder --chown=appuser:appuser /app /app + +WORKDIR /app -LABEL org.opencontainers.image.source="https://github.com/open-webui/oikb" -LABEL org.opencontainers.image.description="CLI tool for syncing content to Open WebUI Knowledge Bases" +USER appuser -# Install oikb from the built wheel. -COPY --from=builder /app/dist/*.whl /tmp/ -RUN pip install --no-cache-dir /tmp/*.whl && rm /tmp/*.whl +ENV PATH="/app/.venv/bin:$PATH" -# Sync source is mounted at /data by convention. -VOLUME ["/data"] -WORKDIR /data +EXPOSE 8080 ENTRYPOINT ["oikb"] diff --git a/README.md b/README.md index cb74bda..b413acc 100644 --- a/README.md +++ b/README.md @@ -129,9 +129,11 @@ services: - open-webui restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"] + test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/health/ready"] interval: 30s timeout: 5s + retries: 3 + start_period: 15s ``` ## 44 Connectors diff --git a/docker-compose.yaml b/docker-compose.yaml index bd56269..453df9f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,9 +22,11 @@ services: - open-webui restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"] + test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/health/ready"] interval: 30s timeout: 5s + retries: 3 + start_period: 15s volumes: open-webui: diff --git a/docs/guide.md b/docs/guide.md index 7323dc0..a291f17 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -595,9 +595,11 @@ services: - open-webui restart: unless-stopped healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/health/ready"] + test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/health/ready"] interval: 30s timeout: 5s + retries: 3 + start_period: 15s ``` ### GitHub Actions