File tree Expand file tree Collapse file tree 3 files changed +56
-3
lines changed Expand file tree Collapse file tree 3 files changed +56
-3
lines changed Original file line number Diff line number Diff line change 1+ node_modules
2+ bun.lock
3+
4+ .vscode /
5+
6+ .git /
7+ .github /
8+ .gitignore
9+
10+ dist /
11+ tests /
12+ * .md
13+
14+ .eslintcache
Original file line number Diff line number Diff line change 1- FROM oven/bun:alpine AS builder
1+ FROM oven/bun:1.2.19- alpine AS builder
22WORKDIR /app
33
44COPY ./package.json ./bun.lock ./
@@ -7,7 +7,7 @@ RUN bun install --frozen-lockfile
77COPY . .
88RUN bun run build
99
10- FROM oven/bun:alpine AS runner
10+ FROM oven/bun:1.2.19- alpine AS runner
1111WORKDIR /app
1212
1313COPY ./package.json ./bun.lock ./
@@ -17,7 +17,11 @@ COPY --from=builder /app/dist ./dist
1717
1818EXPOSE 4141
1919
20+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
21+ CMD wget --spider -q http://localhost:4141/ || exit 1
22+
2023ARG GH_TOKEN
2124ENV GH_TOKEN=$GH_TOKEN
2225
23- CMD bun run dist/main.js start -g $GH_TOKEN
26+ ENTRYPOINT ["bun" , "run" , "dist/main.js" ]
27+ CMD ["start" , "-g" , "$GH_TOKEN" ]
Original file line number Diff line number Diff line change @@ -57,6 +57,41 @@ Run the container
5757docker run -p 4141:4141 copilot-api
5858```
5959
60+ ### Docker with Environment Variables
61+
62+ You can pass the GitHub token directly to the container using environment variables:
63+
64+ ``` sh
65+ # Build with GitHub token
66+ docker build --build-arg GH_TOKEN=your_github_token_here -t copilot-api .
67+
68+ # Run with GitHub token
69+ docker run -p 4141:4141 -e GH_TOKEN=your_github_token_here copilot-api
70+
71+ # Run with additional options
72+ docker run -p 4141:4141 -e GH_TOKEN=your_token copilot-api start --verbose --port 4141
73+ ```
74+
75+ ### Docker Compose Example
76+
77+ ``` yaml
78+ version : ' 3.8'
79+ services :
80+ copilot-api :
81+ build : .
82+ ports :
83+ - " 4141:4141"
84+ environment :
85+ - GH_TOKEN=your_github_token_here
86+ restart : unless-stopped
87+ ` ` `
88+
89+ The Docker image includes:
90+ - Multi-stage build for optimized image size
91+ - Non-root user for enhanced security
92+ - Health check for container monitoring
93+ - Pinned base image version for reproducible builds
94+
6095## Using with npx
6196
6297You can run the project directly using npx:
You can’t perform that action at this time.
0 commit comments