-
Notifications
You must be signed in to change notification settings - Fork 5
Add a container image and local Docker install path #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| .git | ||
| .codex | ||
| .DS_Store | ||
| .env | ||
| .env.* | ||
| .evidence-cache | ||
| .vercel | ||
| .vs | ||
| coverage | ||
| dist | ||
| docs | ||
| docs/evidence-candidates/dna-bulk-*.json | ||
| docs/evidence-candidates/dna-seed-*.json | ||
| docs/evidence-candidates/dna-seed-*/ | ||
| node_modules | ||
| stats.html | ||
| *.tsbuildinfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Publish container | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - "v*" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
|
|
||
| jobs: | ||
| image: | ||
| name: Build container image | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Resolve image name | ||
| run: echo "IMAGE_NAME=${GITHUB_REPOSITORY_OWNER,,}/deana" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| flavor: latest=false | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=ref,event=tag | ||
| type=sha,prefix=sha- | ||
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | ||
|
|
||
| - name: Build image and publish on non-PR events | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| provenance: true | ||
| sbom: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ dist | |
| .env.* | ||
| !.env.example | ||
| .vercel | ||
| bun.lock | ||
| *.tsbuildinfo | ||
| stats.html | ||
| vite.config.js | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # syntax=docker/dockerfile:1.7 | ||
|
|
||
| ARG BUN_IMAGE=oven/bun:1.3.10-slim | ||
|
|
||
| FROM ${BUN_IMAGE} AS deps | ||
| WORKDIR /app | ||
| COPY package.json bun.lock ./ | ||
| RUN bun install --frozen-lockfile | ||
|
|
||
| FROM deps AS build | ||
| COPY index.html tsconfig*.json vite.config.ts vite.config.js vite.config.d.ts ./ | ||
| COPY public ./public | ||
| COPY src ./src | ||
| COPY api ./api | ||
| RUN bun run build | ||
|
|
||
| FROM ${BUN_IMAGE} AS production-deps | ||
| WORKDIR /app | ||
| ENV NODE_ENV=production | ||
| COPY package.json bun.lock ./ | ||
| RUN bun install --frozen-lockfile --production | ||
|
|
||
| FROM ${BUN_IMAGE} AS runtime | ||
| WORKDIR /app | ||
| ENV NODE_ENV=production \ | ||
| HOST=0.0.0.0 \ | ||
| PORT=8080 | ||
|
|
||
| COPY --from=production-deps --chown=bun:bun /app/node_modules ./node_modules | ||
| COPY --from=build --chown=bun:bun /app/dist ./dist | ||
| COPY --chown=bun:bun package.json ./ | ||
| COPY --chown=bun:bun server ./server | ||
| COPY --chown=bun:bun api/ai-status.ts api/chat.ts api/chat-title.ts ./api/ | ||
| COPY --chown=bun:bun src/lib ./src/lib | ||
| COPY --chown=bun:bun src/types.ts ./src/types.ts | ||
|
|
||
| USER bun | ||
| EXPOSE 8080 | ||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD bun -e "fetch('http://127.0.0.1:' + (process.env.PORT || '8080') + '/healthz').then((r) => { if (!r.ok) process.exit(1); }).catch(() => process.exit(1));" | ||
| CMD ["bun", "run", "start"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { afterEach, describe, expect, it } from "vitest"; | ||
| import handler from "./ai-status.js"; | ||
|
|
||
| const originalEnv = { ...process.env }; | ||
|
|
||
| function statusRequest(): Request { | ||
| return new Request("https://deana.test/api/ai-status", { | ||
| method: "GET", | ||
| }); | ||
| } | ||
|
|
||
| async function responseBody(response: Response): Promise<Record<string, unknown>> { | ||
| return await response.json() as Record<string, unknown>; | ||
| } | ||
|
|
||
| function enableGatewayAuth(): void { | ||
| process.env.AI_GATEWAY_API_KEY = "secret-key"; | ||
| } | ||
|
|
||
| describe("AI status endpoint", () => { | ||
| afterEach(() => { | ||
| process.env = { ...originalEnv }; | ||
| }); | ||
|
|
||
| it("reports runtime model options without exposing secrets", async () => { | ||
| enableGatewayAuth(); | ||
| process.env.VITE_DEANA_MODEL_LIST = "google/gemini-3-flash, openai/gpt-5-mini"; | ||
|
|
||
| const response = await handler(statusRequest()); | ||
|
|
||
| expect(response.status).toBe(200); | ||
| await expect(responseBody(response)).resolves.toEqual({ | ||
| enabled: true, | ||
| model: "google/gemini-3-flash", | ||
| models: ["google/gemini-3-flash", "openai/gpt-5-mini"], | ||
| }); | ||
| }); | ||
|
|
||
| it("hides the fallback model in production responses", async () => { | ||
| enableGatewayAuth(); | ||
| process.env.VERCEL_ENV = "production"; | ||
|
|
||
| const response = await handler(statusRequest()); | ||
| const body = await responseBody(response); | ||
|
|
||
| expect(body.enabled).toBe(true); | ||
| expect(body.models).toEqual(expect.arrayContaining(["google/gemini-3-flash"])); | ||
| expect(body).not.toHaveProperty("model"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.