From f12c45f692ff56dd671666b358bf8db9212b757e Mon Sep 17 00:00:00 2001 From: openclaw Date: Mon, 23 Mar 2026 17:25:02 +0000 Subject: [PATCH] =?UTF-8?q?build:=20add=20Docker=20deployment=20=E2=80=94?= =?UTF-8?q?=20Compose,=20Dockerfiles,=20Nginx=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- backend/Dockerfile | 7 +++++++ docker-compose.yml | 21 +++++++++++++++++++++ frontend/Dockerfile | 11 +++++++++++ frontend/nginx.conf | 15 +++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 backend/Dockerfile create mode 100644 docker-compose.yml create mode 100644 frontend/Dockerfile create mode 100644 frontend/nginx.conf diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..b133fdd --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.12-slim +WORKDIR /app +COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv +COPY pyproject.toml uv.lock ./ +RUN uv sync --frozen --no-dev +COPY app/ app/ +CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8900"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4f44059 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +services: + backend: + build: ./backend + ports: + - "8900:8900" + volumes: + - ${DESIGN_DIR:-.}:/data/design:rw + - ${CODE_DIR:-/dev/null}:/data/code:ro + - registry-data:/data/registry + environment: + - REGISTRY_PATH=/data/registry/projects.json + + frontend: + build: ./frontend + ports: + - "80:80" + depends_on: + - backend + +volumes: + registry-data: diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..9cd49d8 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,11 @@ +FROM node:20-alpine AS build +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npm run build + +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..dfa7a89 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location /api/ { + proxy_pass http://backend:8900; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location / { + try_files $uri $uri/ /index.html; + } +}