From 1adf91a19b012c9e31af90b5972d5ef774f8ca85 Mon Sep 17 00:00:00 2001 From: gahusb Date: Tue, 19 May 2026 02:02:58 +0900 Subject: [PATCH] feat(services/insta-render): Dockerfile + requirements + env.example (SP-3 scaffold) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows WSL2 Docker용 Chromium 워커 컨테이너 기본 골격. 다음 task에서 main.py, worker.py, card_renderer.py 작성. Plan-B-Insta Phase 2 시작. Co-Authored-By: Claude Opus 4.7 (1M context) --- services/insta-render/.env.example | 17 +++++++++++++++++ services/insta-render/Dockerfile | 22 ++++++++++++++++++++++ services/insta-render/requirements.txt | 9 +++++++++ services/insta-render/templates/.gitkeep | 0 services/insta-render/tests/.gitkeep | 0 5 files changed, 48 insertions(+) create mode 100644 services/insta-render/.env.example create mode 100644 services/insta-render/Dockerfile create mode 100644 services/insta-render/requirements.txt create mode 100644 services/insta-render/templates/.gitkeep create mode 100644 services/insta-render/tests/.gitkeep diff --git a/services/insta-render/.env.example b/services/insta-render/.env.example new file mode 100644 index 0000000..1fe981f --- /dev/null +++ b/services/insta-render/.env.example @@ -0,0 +1,17 @@ +# Plan-B-Insta — Windows insta-render worker + +# NAS Redis 큐 +REDIS_URL=redis://192.168.45.54:6379 + +# NAS internal webhook +NAS_BASE_URL=http://192.168.45.54:18700 +INTERNAL_API_KEY=__copy_from_nas_dotenv__ + +# NAS SMB mount 안의 미디어 디렉토리 (/mnt/nas/webpage/data/insta/) +INSTA_MEDIA_ROOT=/mnt/nas/webpage/data/insta + +# nginx 서빙 prefix (NAS webhook payload에 보낼 result_path 만들 때) +INSTA_MEDIA_URL_PREFIX=/media/insta + +# Jinja 템플릿 디렉토리 (이 컨테이너 안) +CARD_TEMPLATE_DIR=/app/templates diff --git a/services/insta-render/Dockerfile b/services/insta-render/Dockerfile new file mode 100644 index 0000000..e474347 --- /dev/null +++ b/services/insta-render/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.12-slim-bookworm +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +# Korean fonts + Chromium runtime deps (Debian 12 / bookworm) +RUN apt-get update && apt-get install -y --no-install-recommends \ + fonts-noto-cjk fonts-noto-cjk-extra \ + libnss3 libnspr4 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 \ + libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \ + libxfixes3 libxrandr2 libgbm1 libxshmfence1 libpango-1.0-0 \ + libcairo2 libasound2 libatspi2.0-0 \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --no-cache-dir --timeout 600 --retries 5 -r requirements.txt +RUN playwright install chromium + +COPY . . + +EXPOSE 8000 +CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"] diff --git a/services/insta-render/requirements.txt b/services/insta-render/requirements.txt new file mode 100644 index 0000000..cd7c5e3 --- /dev/null +++ b/services/insta-render/requirements.txt @@ -0,0 +1,9 @@ +fastapi==0.115.6 +uvicorn[standard]==0.34.0 +playwright==1.48.0 +jinja2>=3.1.4 +Pillow>=10 +redis>=5.0 +httpx>=0.27 +pytest>=8.0 +pytest-asyncio>=0.24 diff --git a/services/insta-render/templates/.gitkeep b/services/insta-render/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/services/insta-render/tests/.gitkeep b/services/insta-render/tests/.gitkeep new file mode 100644 index 0000000..e69de29