Skip to content

Commit 979fd31

Browse files
Userclaude
authored andcommitted
ci(docker): build server/ instead of api/ as the published image
The published ghcr.io/sentinel-bluebuilder/x402:latest image was being built from api/ (the on-chain-event design), so anyone running the docker-compose was actually getting the api/ implementation, not the canonical EIP-3009 server/ described in the README. - Add server/Dockerfile (multi-stage build, no DB volume, runs as unprivileged user, exposes 4020; self-hosted facilitator binds 4021 internally inside the container) - Add server/docker-compose.yml (matches the previous api/ compose shape so existing deployments only need a port + env-var update) - Update .github/workflows/build.yml to watch server/** and build from ./server/Dockerfile Operators upgrading from the api/ image will need to swap envs: remove PAYMENT_CONTRACT_ADDRESS, OPERATOR_EVM_ADDRESS, HELIUS_*, PRICE_PER_DAY_USDC, MIN_DAYS, MAX_DAYS, DATABASE_PATH; add OPERATOR_ADDRESS, FACILITATOR_PRIVATE_KEY (or CDP_API_KEY_*); change the published port from 3402 to 4020. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d38ba1b commit 979fd31

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ "master" ]
66
paths:
7-
- "api/**"
7+
- "server/**"
88
- ".github/workflows/build.yml"
99
workflow_dispatch:
1010

@@ -36,8 +36,8 @@ jobs:
3636
uses: docker/build-push-action@v6
3737
with:
3838
push: true
39-
context: ./api
40-
file: ./api/Dockerfile
39+
context: ./server
40+
file: ./server/Dockerfile
4141
tags: |
4242
ghcr.io/${{ env.REPO }}:latest
4343
ghcr.io/${{ env.REPO }}:${{ github.sha }}

server/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# syntax=docker/dockerfile:1.7
2+
3+
# ─── Build the server ───
4+
FROM node:22-alpine AS build
5+
WORKDIR /app
6+
COPY package.json package-lock.json* ./
7+
RUN npm ci
8+
COPY tsconfig.json ./
9+
COPY src ./src
10+
RUN npm run build
11+
12+
# ─── Production deps only ───
13+
FROM node:22-alpine AS deps
14+
WORKDIR /app
15+
COPY package.json package-lock.json* ./
16+
RUN npm ci --omit=dev
17+
18+
# ─── Runtime ───
19+
FROM node:22-alpine AS runtime
20+
WORKDIR /app
21+
ENV NODE_ENV=production
22+
ENV PORT=4020
23+
ENV FACILITATOR_PORT=4021
24+
25+
RUN addgroup -S app && adduser -S app -G app
26+
27+
COPY --from=deps /app/node_modules ./node_modules
28+
COPY --from=build /app/dist ./dist
29+
COPY package.json ./
30+
31+
USER app
32+
33+
EXPOSE 4020
34+
35+
CMD ["node", "dist/index.js"]

server/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
backend:
3+
image: ghcr.io/sentinel-bluebuilder/x402:latest
4+
container_name: x402
5+
restart: unless-stopped
6+
pull_policy: always
7+
env_file:
8+
- .env
9+
ports:
10+
- "4020:4020"

0 commit comments

Comments
 (0)