-
Notifications
You must be signed in to change notification settings - Fork 122
FE-1569: Add the Brunch container build and publication path #9495
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
Open
lunelson
wants to merge
6
commits into
main
Choose a base branch
from
ln/fe-1569-brunch-agent-container
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9f629ad
Prepare Brunch deployment artifact and infrastructure handoff
lunelson 979aed4
Wire container build and liveness entry points
lunelson 0ad3491
Publish the Brunch image to ECR
lunelson 440d731
Document the Brunch container task dependency
lunelson 72e2d83
Include the Brunch skill in container builds
lunelson 9144fc8
Fix Brunch container runtime inputs
lunelson 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
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,78 @@ | ||
| # syntax=docker/dockerfile:1 | ||
|
|
||
| # Build from the repository root: | ||
| # docker buildx build --file apps/brunch-agent/docker/Dockerfile . --load | ||
|
|
||
| FROM debian:13.3-slim AS tools | ||
|
|
||
| SHELL ["/bin/bash", "-euo", "pipefail", "-c"] | ||
|
|
||
| ENV MISE_DATA_DIR="/mise" | ||
| ENV MISE_CACHE_DIR="/mise/cache" | ||
| ENV PATH="/mise/shims:$PATH" | ||
|
|
||
| COPY .config/mise /etc/mise | ||
|
|
||
| RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_TOKEN \ | ||
| apt-get update && \ | ||
| apt-get install -y --no-install-recommends ca-certificates curl && \ | ||
| /etc/mise/install.sh && \ | ||
| mise --version && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* && \ | ||
| eval "$(mise activate bash)" && \ | ||
| mise install --locked node npm:turbo yq | ||
|
|
||
|
|
||
| FROM tools AS pruner | ||
|
|
||
| WORKDIR /repo | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN mise trust && \ | ||
| turbo prune $(.github/scripts/prune-scopes.sh '@apps/brunch-agent') --docker | ||
|
|
||
|
|
||
| FROM tools AS builder | ||
|
|
||
| WORKDIR /repo | ||
|
|
||
| RUN corepack enable | ||
|
|
||
| COPY --from=pruner /repo/out/json/ ./ | ||
| COPY --from=pruner /repo/out/yarn.lock ./yarn.lock | ||
| COPY --from=pruner /repo/out/full/.yarn ./.yarn | ||
| COPY --from=pruner /repo/out/full/turbo.json ./turbo.json | ||
|
|
||
| RUN --mount=type=cache,target=/root/.yarn/berry/cache \ | ||
| yarn install --immutable | ||
|
|
||
| COPY --from=pruner /repo/out/full/ ./ | ||
|
|
||
| RUN turbo run build --filter '@apps/brunch-agent' --env-mode=loose && \ | ||
| yarn workspaces focus @apps/brunch-agent --production && \ | ||
| rm -rf apps/brunch-agent/test | ||
|
|
||
|
|
||
| FROM tools AS runner | ||
|
|
||
| ENV NODE_ENV=production | ||
|
|
||
| WORKDIR /repo/apps/brunch-agent | ||
|
|
||
| COPY --from=builder /repo /repo | ||
|
|
||
| RUN groupadd --system --gid 60000 hash && \ | ||
| useradd --system --uid 60000 --gid hash --create-home brunch && \ | ||
| install --directory --owner brunch --group hash \ | ||
| /repo/apps/brunch-agent/.data-wipe-me | ||
|
|
||
| USER brunch:hash | ||
|
|
||
| EXPOSE 3000 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to use another port, the frontend is already using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We agreed on port 3002 in slack. |
||
|
|
||
| HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ | ||
| CMD ["node", "-e", "fetch('http://127.0.0.1:3000/health').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"] | ||
|
|
||
| CMD ["node", "dist/server.mjs"] | ||
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
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,7 @@ | ||
| import type { Context } from "hono"; | ||
|
|
||
| export const healthHandler = (context: Context): Response => | ||
| context.json({ status: "pass" }, 200, { | ||
| "cache-control": "no-store", | ||
| "content-type": "application/health+json", | ||
| }); |
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,24 @@ | ||
| import { Hono } from "hono"; | ||
| import { expect, test, vi } from "vitest"; | ||
|
|
||
| import { healthHandler } from "../src/health.ts"; | ||
|
|
||
| test("health reports liveness without consulting dependencies", async () => { | ||
| const dependency = vi.fn<() => void>(); | ||
| const app = new Hono(); | ||
| app.get("/health", (context) => { | ||
| const response = healthHandler(context); | ||
| expect(dependency).not.toHaveBeenCalled(); | ||
| return response; | ||
| }); | ||
|
|
||
| const response = await app.request("/health"); | ||
|
|
||
| expect(response.status).toBe(200); | ||
| expect(response.headers.get("cache-control")).toBe("no-store"); | ||
| expect(response.headers.get("content-type")).toContain( | ||
| "application/health+json", | ||
| ); | ||
| await expect(response.json()).resolves.toEqual({ status: "pass" }); | ||
| expect(dependency).not.toHaveBeenCalled(); | ||
| }); |
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.