Compare commits
12 Commits
main
...
test/watch
| Author | SHA1 | Date | |
|---|---|---|---|
| 4eb2fbef58 | |||
| aadfd459b3 | |||
| e01437a1ed | |||
| b86251f5a4 | |||
| c271e113af | |||
| 93233a6bab | |||
| 4ba39deff6 | |||
| 058e36b7e4 | |||
| 8f16f2b18d | |||
| a9ef4f4ca0 | |||
| 5cd3cb42c3 | |||
| 70cdf742aa |
@@ -1,5 +1,3 @@
|
|||||||
*
|
node_modules
|
||||||
!Dockerfile
|
**/node_modules
|
||||||
!server.js
|
.git
|
||||||
!public/
|
|
||||||
!public/**
|
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -1,36 +1,12 @@
|
|||||||
# OpenAI Chat Demo
|
# Watch paths Phase 4 fixture
|
||||||
|
|
||||||
A small web chat service that sends questions to the OpenAI Responses API. The browser talks only to this app; `API_KEY` stays in the server container and is never sent to the browser.
|
Small two-service monorepo used to accept the per-service Gitea watch-path filtering flow.
|
||||||
|
|
||||||
## Configuration
|
- `web/` builds from repository root and uses `packages/shared`, root npm workspace manifests, and `healthcare-miniapp/package.json` as build inputs.
|
||||||
|
- `backend/` builds from its own directory and has no dependency on web files.
|
||||||
|
|
||||||
The container uses exactly two application environment variables:
|
Both containers expose `/health` on port 8080. No external services or credentials are needed.
|
||||||
|
|
||||||
| Variable | Purpose | Example |
|
Phase 4 acceptance probe: root documentation only.
|
||||||
| --- | --- | --- |
|
|
||||||
| `MODEL` | OpenAI model name to call | `gpt-4.1-mini` |
|
|
||||||
| `API_KEY` | OpenAI API key; configure this as a secret | Set it in the runtime secret manager |
|
|
||||||
|
|
||||||
The app listens on port `8080`.
|
Phase 4 acceptance probe: docs-only commit after relevant change.
|
||||||
|
|
||||||
## Run with Docker
|
|
||||||
|
|
||||||
Set the real key in your shell or secret manager, then run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
docker run --rm -p 8080:8080 \
|
|
||||||
-e MODEL=gpt-4.1-mini \
|
|
||||||
-e API_KEY \
|
|
||||||
lucnguyen666/aisp-openai-chat-demo:1.0.0
|
|
||||||
```
|
|
||||||
|
|
||||||
Open <http://localhost:8080>. For a platform deployment, map `MODEL` as a regular environment variable and `API_KEY` as a secret environment variable.
|
|
||||||
|
|
||||||
## Build locally
|
|
||||||
|
|
||||||
```sh
|
|
||||||
docker build -t aisp-openai-chat-demo:local .
|
|
||||||
docker run --rm -p 8080:8080 -e MODEL=gpt-4.1-mini -e API_KEY aisp-openai-chat-demo:local
|
|
||||||
```
|
|
||||||
|
|
||||||
The chat history is held in browser memory for the current page session. The server calls `POST https://api.openai.com/v1/responses` with `store: false`. It does not log prompts or API keys.
|
|
||||||
|
|||||||
7
backend/Dockerfile
Normal file
7
backend/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FROM docker.io/library/node:22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --chown=1000:1000 server.js ./server.js
|
||||||
|
USER 1000
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["node", "server.js"]
|
||||||
8
backend/server.js
Normal file
8
backend/server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const http = require("node:http");
|
||||||
|
const server = http.createServer((request, response) => {
|
||||||
|
response.setHeader("Content-Type", "application/json");
|
||||||
|
response.writeHead(200).end(JSON.stringify({ status: "ok", service: "backend" }));
|
||||||
|
});
|
||||||
|
server.listen(8080, "0.0.0.0");
|
||||||
|
|
||||||
|
// phase 4 selected backend source probe
|
||||||
5
healthcare-miniapp/package.json
Normal file
5
healthcare-miniapp/package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "watch-paths-fixture-miniapp",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"private": true
|
||||||
|
}
|
||||||
42
package-lock.json
generated
Normal file
42
package-lock.json
generated
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "watch-paths-phase4-fixture",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "watch-paths-phase4-fixture",
|
||||||
|
"workspaces": [
|
||||||
|
"web",
|
||||||
|
"packages/shared",
|
||||||
|
"healthcare-miniapp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"healthcare-miniapp": {
|
||||||
|
"name": "watch-paths-fixture-miniapp",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"node_modules/watch-paths-fixture-miniapp": {
|
||||||
|
"resolved": "healthcare-miniapp",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
|
"node_modules/watch-paths-fixture-shared": {
|
||||||
|
"resolved": "packages/shared",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
|
"node_modules/watch-paths-fixture-web": {
|
||||||
|
"resolved": "web",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
|
"packages/shared": {
|
||||||
|
"name": "watch-paths-fixture-shared",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"web": {
|
||||||
|
"name": "watch-paths-fixture-web",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"watch-paths-fixture-shared": "file:../packages/shared"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
package.json
Normal file
5
package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "watch-paths-phase4-fixture",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": ["web", "packages/shared", "healthcare-miniapp"]
|
||||||
|
}
|
||||||
1
packages/shared/index.js
Normal file
1
packages/shared/index.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = { fixtureName: "watch-paths-phase4-shared" };
|
||||||
1
packages/shared/package.json
Normal file
1
packages/shared/package.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"name":"watch-paths-fixture-shared","version":"1.0.0","main":"index.js"}
|
||||||
14
web/Dockerfile
Normal file
14
web/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM docker.io/library/node:22-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
COPY --chown=1000:1000 package.json package-lock.json ./
|
||||||
|
COPY --chown=1000:1000 packages/shared/package.json ./packages/shared/
|
||||||
|
COPY --chown=1000:1000 healthcare-miniapp/package.json ./healthcare-miniapp/
|
||||||
|
COPY --chown=1000:1000 web/package.json ./web/
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
COPY --chown=1000:1000 packages/shared ./packages/shared
|
||||||
|
COPY --chown=1000:1000 web ./web
|
||||||
|
WORKDIR /app/web
|
||||||
|
USER 1000
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["npm", "start"]
|
||||||
1
web/docs/README.md
Normal file
1
web/docs/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Documentation-only path used to verify excluded changes
|
||||||
1
web/multi-commit-probe.txt
Normal file
1
web/multi-commit-probe.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
relevant first commit within one push
|
||||||
11
web/package.json
Normal file
11
web/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "watch-paths-fixture-web",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "node server.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"watch-paths-fixture-shared": "file:../packages/shared"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
web/server.js
Normal file
11
web/server.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const http = require("node:http");
|
||||||
|
const { fixtureName } = require("watch-paths-fixture-shared");
|
||||||
|
const server = http.createServer((request, response) => {
|
||||||
|
response.setHeader("Content-Type", "application/json");
|
||||||
|
if (request.url === "/health") {
|
||||||
|
response.writeHead(200).end(JSON.stringify({ status: "ok", service: "web", fixtureName }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
response.writeHead(200).end(JSON.stringify({ service: "web", fixtureName }));
|
||||||
|
});
|
||||||
|
server.listen(8080, "0.0.0.0");
|
||||||
Reference in New Issue
Block a user