Skip to content

Commit 57a85b0

Browse files
committed
feat: add docker support
1 parent ad3a7e5 commit 57a85b0

3 files changed

Lines changed: 163 additions & 1 deletion

File tree

.dockerignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output (will be rebuilt in container)
5+
dist/
6+
7+
# Git
8+
.git/
9+
.gitignore
10+
11+
# IDE
12+
.vscode/
13+
.idea/
14+
*.swp
15+
*.swo
16+
17+
# Test and coverage
18+
coverage/
19+
.nyc_output/
20+
21+
# Logs
22+
*.log
23+
npm-debug.log*
24+
pnpm-debug.log*
25+
26+
# OS files
27+
.DS_Store
28+
Thumbs.db
29+
30+
# Environment files
31+
.env
32+
.env.*
33+
34+
# Docker
35+
Dockerfile
36+
.dockerignore

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM node:22
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update \
6+
&& apt-get install -y vim git build-essential \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
# Copy dependency files for version extraction
10+
COPY package.json pnpm-lock.yaml ./
11+
12+
# Parse peerDependenciesMeta and install corresponding versions
13+
RUN node -e " \
14+
const fs = require('fs'); \
15+
const { execSync } = require('child_process'); \
16+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')); \
17+
const lock = fs.readFileSync('./pnpm-lock.yaml', 'utf8'); \
18+
const peers = Object.keys(pkg.peerDependenciesMeta || {}); \
19+
const packages = peers.map(name => { \
20+
const regex = new RegExp('[/\\\\s]' + name + '@([0-9.]+)[:\\\\)]'); \
21+
const match = lock.match(regex); \
22+
if (!match) throw new Error('Version not found in lockfile for: ' + name); \
23+
return name + '@' + match[1]; \
24+
}); \
25+
console.log('Installing peerDependencies:', packages.join(' ')); \
26+
if (packages.length > 0) { \
27+
execSync('npm install -g ' + packages.join(' '), { stdio: 'inherit' }); \
28+
} \
29+
"
30+
31+
# Set environment variables
32+
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright-browsers
33+
ENV NODE_PATH=/usr/local/lib/node_modules
34+
35+
# Install Playwright browsers and system dependencies
36+
RUN npx playwright install --with-deps chromium \
37+
&& chmod -R 755 $PLAYWRIGHT_BROWSERS_PATH
38+
39+
RUN npm install -g pnpm
40+
41+
# Install coderio
42+
RUN npm install -g coderio
43+
44+
45+
# Clean up temporary files
46+
RUN rm -f package.json pnpm-lock.yaml

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,87 @@ report path: coderio/<design-name_node-id>/process/validation/index.html
147147
| `validate` | `val` | Run validation on generated code |
148148
| `images` | - | Download and process Figma assets |
149149

150-
### Option 2: Skill (Portable Embedded Workflow)
150+
### Option 2: Docker
151+
152+
Best for portable environments without Node.js installation.
153+
154+
#### 1. Prerequisites
155+
156+
- [Docker](https://docs.docker.com/get-docker/)
157+
- [Figma Personal Access Token](https://www.figma.com/developers/api#access-tokens)
158+
- LLM API Key ([Anthropic](https://console.anthropic.com/) | [OpenAI](https://platform.openai.com/) | [Google](https://aistudio.google.com/))
159+
160+
#### 2. Installation
161+
162+
```bash
163+
docker pull crpi-p4hwwrt00km3axuk.cn-shanghai.personal.cr.aliyuncs.com/coderio/coderio:v1.0.0
164+
```
165+
166+
#### 3. Configuration
167+
168+
Create a working directory and `config.yaml`:
169+
170+
```bash
171+
mkdir -p ./coderio-app && cd ./coderio-app
172+
cat > config.yaml << 'EOF'
173+
model:
174+
provider: openai # anthropic | openai | google
175+
model: gemini-3-pro-preview
176+
baseUrl: https://api.anthropic.com
177+
apiKey: your-api-key-here
178+
179+
figma:
180+
token: your-figma-token-here
181+
182+
debug:
183+
enabled: false
184+
EOF
185+
```
186+
187+
#### 4. Usage
188+
189+
```bash
190+
docker run -ti --rm \
191+
--network=host \
192+
-v ${PWD}:/app \
193+
-v ./config.yaml:/root/.coderio/config.yaml \
194+
crpi-p4hwwrt00km3axuk.cn-shanghai.personal.cr.aliyuncs.com/coderio/coderio:v1.0.0 bash
195+
```
196+
197+
Once inside the container, use CodeRio commands:
198+
199+
```bash
200+
# Convert Figma design to code (default mode: code only)
201+
coderio d2c -s 'https://www.figma.com/design/your-file-id/...'
202+
203+
# Full mode: Generate code + visual validation + auto-refinement
204+
coderio d2c -s 'https://www.figma.com/design/your-file-id/...' -m full
205+
```
206+
207+
#### 5. Run Your Project
208+
209+
```bash
210+
# Navigate to generated project
211+
cd coderio/<design-name_node-id>/my-app
212+
213+
# Install dependencies
214+
pnpm install
215+
216+
# Start dev server
217+
pnpm dev
218+
219+
# 🎉 Open http://localhost:5173
220+
```
221+
222+
#### 6. View Validation Report
223+
224+
Generated files are mounted to your host machine. Open the validation report in your browser:
225+
226+
```
227+
./coderio/<design-name_node-id>/process/validation/index.html
228+
```
229+
230+
### Option 3: Skill (Portable Embedded Workflow)
151231

152232
Best for control and precision using AI Agents.
153233

0 commit comments

Comments
 (0)