Skip to content

Commit 1392515

Browse files
committed
chore: add yaduo docker deployment
1 parent f5d11b3 commit 1392515

4 files changed

Lines changed: 138 additions & 0 deletions

File tree

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.git
2+
.DS_Store
3+
.env
4+
.env.*
5+
6+
node_modules
7+
next/node_modules
8+
e2e/node_modules
9+
10+
.next
11+
next/.next
12+
out
13+
next/out
14+
build
15+
16+
coverage
17+
test-results
18+
playwright-report
19+
e2e/ui/reports
20+
e2e/ui/test-results
21+
22+
tmp
23+
*.tsbuildinfo
24+
npm-debug.log*
25+
yarn-debug.log*
26+
pnpm-debug.log*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
html-anything:
3+
build:
4+
context: /opt/apps/html-anything
5+
dockerfile: next/Dockerfile
6+
image: html-anything:local
7+
container_name: html-anything
8+
restart: unless-stopped
9+
ports:
10+
- "3100:3000"
11+
extra_hosts:
12+
- "host.docker.internal:host-gateway"
13+
environment:
14+
NODE_ENV: production
15+
NEXT_TELEMETRY_DISABLED: "1"
16+
CODEX_HOME: /root/.codex
17+
CODEX_BIN: /usr/local/bin/codex
18+
HTML_ANYTHING_ALLOW_ANY_HOST: "1"
19+
MY_PROXY_API_KEY: ${MY_PROXY_API_KEY}
20+
volumes:
21+
- /opt/apps/html-anything-data/codex:/root/.codex
22+
- /opt/apps/html-anything-data/state:/root/.html-anything

docs/deploy/yaduo-server/run.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
APP_DIR="${APP_DIR:-/opt/apps/html-anything}"
5+
DATA_DIR="${DATA_DIR:-/opt/apps/html-anything-data}"
6+
IMAGE="${IMAGE:-html-anything:local}"
7+
CONTAINER="${CONTAINER:-html-anything}"
8+
PORT="${PORT:-3100}"
9+
10+
mkdir -p "$DATA_DIR/codex" "$DATA_DIR/state"
11+
12+
if [ ! -f "$DATA_DIR/codex/config.toml" ]; then
13+
cat > "$DATA_DIR/codex/config.toml" <<'EOF'
14+
model_provider = "codexzh"
15+
model = "gpt-5.5"
16+
17+
[model_providers.codexzh]
18+
name = "codexzh"
19+
base_url = "http://host.docker.internal:2345/v1"
20+
wire_api = "responses"
21+
requires_openai_auth = true
22+
web_search = "live"
23+
EOF
24+
fi
25+
26+
docker build -f "$APP_DIR/next/Dockerfile" -t "$IMAGE" "$APP_DIR"
27+
28+
docker rm -f "$CONTAINER" >/dev/null 2>&1 || true
29+
30+
docker run -d \
31+
--name "$CONTAINER" \
32+
--restart unless-stopped \
33+
--add-host host.docker.internal:host-gateway \
34+
-p "$PORT:3000" \
35+
-e NODE_ENV=production \
36+
-e NEXT_TELEMETRY_DISABLED=1 \
37+
-e CODEX_HOME=/root/.codex \
38+
-e CODEX_BIN=/usr/local/bin/codex \
39+
-e HTML_ANYTHING_ALLOW_ANY_HOST=1 \
40+
-v "$DATA_DIR/codex:/root/.codex" \
41+
-v "$DATA_DIR/state:/root/.html-anything" \
42+
"$IMAGE"

next/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:24-bookworm-slim AS base
4+
5+
ENV PNPM_HOME=/pnpm
6+
ENV PATH="${PNPM_HOME}:${PATH}"
7+
ENV NEXT_TELEMETRY_DISABLED=1
8+
9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends ca-certificates curl git openssh-client \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
RUN corepack enable \
14+
&& corepack prepare pnpm@10.33.2 --activate \
15+
&& npm install -g @openai/codex
16+
17+
FROM base AS deps
18+
19+
WORKDIR /app
20+
21+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
22+
COPY next/package.json next/package.json
23+
COPY e2e/package.json e2e/package.json
24+
25+
RUN pnpm install --frozen-lockfile
26+
27+
FROM deps AS builder
28+
29+
WORKDIR /app
30+
31+
COPY . .
32+
33+
RUN pnpm -F @html-anything/next build
34+
35+
FROM base AS runner
36+
37+
WORKDIR /app
38+
39+
ENV NODE_ENV=production
40+
ENV CODEX_HOME=/root/.codex
41+
ENV CODEX_BIN=/usr/local/bin/codex
42+
ENV HTML_ANYTHING_ALLOW_ANY_HOST=1
43+
44+
COPY --from=builder /app ./
45+
46+
EXPOSE 3000
47+
48+
CMD ["pnpm", "-F", "@html-anything/next", "start", "-p", "3000", "-H", "0.0.0.0"]

0 commit comments

Comments
 (0)