-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e0fc101
Prepare Brunch deployment artifact and infrastructure handoff
lunelson 2250b75
Wire container build and liveness entry points
lunelson bc9a79e
Publish the Brunch image to ECR
lunelson 0e415bb
Document the Brunch container task dependency
lunelson c2d0a2a
Include the Brunch skill in container builds
lunelson 50cb85d
Fix Brunch container runtime inputs
lunelson f9137c0
Run Brunch container on port 3002
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,79 @@ | ||
| # 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 | ||
| ENV PORT=3002 | ||
|
|
||
| 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 3002 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ | ||
| CMD ["node", "-e", "fetch('http://127.0.0.1:3002/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.