Skip to content

Commit 990067a

Browse files
authored
Merge pull request #25 from redis-applied-ai/init-tweaks
changes for quickstart
2 parents 28523cc + 48bedf7 commit 990067a

File tree

8 files changed

+39
-13
lines changed

8 files changed

+39
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ share/python-wheels/
2222
.installed.cfg
2323
*.egg
2424
MANIFEST
25+
.python-version
2526

2627
# Environment files
2728
.env

Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,29 @@ RUN --mount=type=cache,target=/root/.cache/uv \
3737
mkdir -p /app/artifacts && \
3838
# Attempt to build artifacts, but don't fail build if it requires runtime services
3939
(uv run --no-sync redis-sre-agent pipeline prepare-sources \
40-
--source-dir /app/source_documents \
41-
--prepare-only \
42-
--artifacts-path /app/artifacts || \
40+
--source-dir /app/source_documents \
41+
--prepare-only \
42+
--artifacts-path /app/artifacts || \
4343
echo "Warning: Could not prepare source documents at build time")
4444

4545

4646
# STAGE 2: Runtime
4747
# This is the final image. It will be much smaller.
4848
FROM python:3.12-slim
4949

50-
# Copy uv from the official image for runtime use (needed by entrypoint)
51-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
50+
# Copy uv binary into the runtime image so entrypoint scripts and docker-compose
51+
# commands that use `uv run` work correctly.
52+
COPY --from=builder /bin/uv /bin/uv
53+
54+
# Copy the uv-managed Python installation used by the virtualenv in /app/.venv.
55+
# Without this, /app/.venv/bin/python points at a non-existent interpreter under
56+
# /root/.local/share/uv, which causes `uv run` and even direct venv usage to
57+
# fail with "permission denied" when running as the non-root `app` user.
58+
COPY --from=builder /root/.local/share/uv /root/.local/share/uv
59+
60+
# Make the uv Python tree readable and traversable by the unprivileged `app`
61+
# user so that symlinks in /app/.venv/bin/python* can be resolved.
62+
RUN chmod 755 /root && chmod -R 755 /root/.local/share/uv || true
5263

5364
WORKDIR /app
5465

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dependencies = [
5757
"opentelemetry-instrumentation-httpx>=0.57b0",
5858
"opentelemetry-instrumentation-aiohttp-client>=0.57b0",
5959
"opentelemetry-instrumentation-openai>=0.47.5",
60+
"cryptography>=45.0.0,<46",
6061
"mcp>=1.23.3",
6162
"nltk>=3.9.1",
6263
]

scripts/docker-entrypoint.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ check_knowledge_base() {
3333
fi
3434

3535
# Check if knowledge base has any documents
36+
# grep -c returns 0 and exits with status 1 when there are no matches, so
37+
# we ignore its exit code and default empty output to 0.
3638
local doc_count=$(redis-cli -u "${REDIS_URL:-redis://localhost:6379/0}" \
37-
FT._LIST 2>/dev/null | grep -c "sre_knowledge" || echo "0")
39+
FT._LIST 2>/dev/null | grep -c "sre_knowledge" || true)
40+
41+
if [ -z "$doc_count" ]; then
42+
doc_count=0
43+
fi
3844

3945
if [ "$doc_count" -eq 0 ]; then
4046
log "Knowledge base is empty"

ui/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /app
77
# Install dependencies for development
88
FROM base AS development
99

10-
# Copy package files
10+
# Copy package files for both main app and ui-kit
1111
COPY package*.json ./
1212
COPY ui-kit/package*.json ./ui-kit/
1313

@@ -17,7 +17,7 @@ RUN npm ci --ignore-scripts
1717
# Install ui-kit dependencies
1818
RUN npm --prefix ./ui-kit ci --ignore-scripts
1919

20-
# Copy source code
20+
# Copy remaining source code
2121
COPY . .
2222

2323
# Build ui-kit now that source files are present
@@ -32,7 +32,7 @@ CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000"]
3232
# Production build stage
3333
FROM base AS build
3434

35-
# Copy package files
35+
# Copy package files for both main app and ui-kit
3636
COPY package*.json ./
3737
COPY ui-kit/package*.json ./ui-kit/
3838

@@ -42,7 +42,7 @@ RUN npm ci --ignore-scripts
4242
# Install ui-kit dependencies
4343
RUN npm --prefix ./ui-kit ci --ignore-scripts
4444

45-
# Copy source code
45+
# Copy remaining source code
4646
COPY . .
4747

4848
# Build ui-kit first, then the main app

ui/ui-kit/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
4747
"lint": "eslint src --ext .ts,.tsx",
4848
"lint:fix": "eslint src --ext .ts,.tsx --fix",
49+
"pre-commit": "pre-commit run --all-files",
50+
"pre-commit:install": "pre-commit install --hook-type pre-commit --hook-type pre-push",
51+
"prepare": "echo 'skip pre-commit install in Docker build'",
4952
"prepublishOnly": "npm run clean && npm run build",
5053
"storybook": "storybook dev -p 6006",
5154
"test": "vitest run",
@@ -99,4 +102,4 @@
99102
"react": ">=18.0.0",
100103
"react-dom": ">=18.0.0"
101104
}
102-
}
105+
}

ui/vite.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { defineConfig } from 'vite';
21
import react from '@vitejs/plugin-react';
32
import { resolve } from 'path';
3+
import { defineConfig } from 'vite';
44

55
export default defineConfig({
66
plugins: [react()],
77
resolve: {
88
alias: {
99
'@': resolve(__dirname, 'src'),
10+
'@radar/ui-kit': resolve(__dirname, 'ui-kit/src'),
11+
'@radar/ui-kit/styles': resolve(__dirname, 'ui-kit/src/styles/index.css'),
1012
},
1113
},
1214
server: {

uv.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)