Skip to content

Commit 6979011

Browse files
committed
changes for quickstart
1 parent 1a1be72 commit 6979011

File tree

8 files changed

+56
-14
lines changed

8 files changed

+56
-14
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: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,30 @@ 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 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
63+
5064
WORKDIR /app
5165

5266
# Install ONLY runtime system dependencies

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
]
6162

6263
[dependency-groups]

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: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ 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 ./
12+
COPY ui-kit/package*.json ./ui-kit/
13+
14+
# Copy ui-kit source (needed for build)
15+
COPY ui-kit ./ui-kit/
1216

1317
# Install all dependencies (including dev dependencies)
14-
RUN npm ci
18+
# Use --ignore-scripts to skip pre-commit hooks that require Python
19+
RUN npm ci --ignore-scripts
20+
21+
# Manually build ui-kit since we skipped scripts
22+
RUN cd ui-kit && npm run build && cd ..
1523

16-
# Copy source code
24+
# Copy remaining source code
1725
COPY . .
1826

1927
# Expose port
@@ -25,13 +33,21 @@ CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "3000"]
2533
# Production build stage
2634
FROM base AS build
2735

28-
# Copy package files
36+
# Copy package files for both main app and ui-kit
2937
COPY package*.json ./
38+
COPY ui-kit/package*.json ./ui-kit/
39+
40+
# Copy ui-kit source (needed for build)
41+
COPY ui-kit ./ui-kit/
3042

3143
# Install dependencies
32-
RUN npm ci
44+
# Use --ignore-scripts to skip pre-commit hooks that require Python
45+
RUN npm ci --ignore-scripts
46+
47+
# Manually build ui-kit since we skipped scripts
48+
RUN cd ui-kit && npm run build && cd ..
3349

34-
# Copy source code
50+
# Copy remaining source code
3551
COPY . .
3652

3753
# Build the application

ui/ui-kit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"lint:fix": "eslint src --ext .ts,.tsx --fix",
4949
"pre-commit": "pre-commit run --all-files",
5050
"pre-commit:install": "pre-commit install --hook-type pre-commit --hook-type pre-push",
51-
"prepare": "pre-commit install",
51+
"prepare": "echo 'skip pre-commit install in Docker build'",
5252
"prepublishOnly": "npm run clean && npm run build",
5353
"storybook": "storybook dev -p 6006",
5454
"test": "vitest run",
@@ -102,4 +102,4 @@
102102
"react": ">=18.0.0",
103103
"react-dom": ">=18.0.0"
104104
}
105-
}
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)