feat(naver-fetch): Dockerfile(Playwright) + compose 서비스(18716) + .env.example
This commit is contained in:
@@ -152,3 +152,27 @@ services:
|
|||||||
interval: 60s
|
interval: 60s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
|
naver-fetch:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: naver-fetch/Dockerfile
|
||||||
|
container_name: naver-fetch
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "18716:8000"
|
||||||
|
environment:
|
||||||
|
- TZ=Asia/Seoul
|
||||||
|
- REDIS_URL=${REDIS_URL:-redis://192.168.45.54:6379}
|
||||||
|
- NAS_BASE_URL=${NAS_BASE_URL:-http://192.168.45.54:18500}
|
||||||
|
- INTERNAL_API_KEY=${INTERNAL_API_KEY:-}
|
||||||
|
- FETCH_INTERVAL_HOURS=${FETCH_INTERVAL_HOURS:-2.5}
|
||||||
|
- DAYTIME_START=${DAYTIME_START:-08:00}
|
||||||
|
- DAYTIME_END=${DAYTIME_END:-20:00}
|
||||||
|
- NAVER_REAL_ESTATE_TYPE=${NAVER_REAL_ESTATE_TYPE:-APT:ABYG:JGC:PRE}
|
||||||
|
- NAVER_HEADLESS=${NAVER_HEADLESS:-1}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
||||||
|
interval: 60s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
|||||||
16
services/naver-fetch/.env.example
Normal file
16
services/naver-fetch/.env.example
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# naver-fetch — realestate 매물 fetch 워커
|
||||||
|
|
||||||
|
REDIS_URL=redis://192.168.45.54:6379
|
||||||
|
NAS_BASE_URL=http://192.168.45.54:18500
|
||||||
|
# render 워커 공유키 (X-Internal-Key)
|
||||||
|
INTERNAL_API_KEY=
|
||||||
|
|
||||||
|
# 스케줄 (KST)
|
||||||
|
FETCH_INTERVAL_HOURS=2.5
|
||||||
|
DAYTIME_START=08:00
|
||||||
|
DAYTIME_END=20:00
|
||||||
|
|
||||||
|
# 네이버
|
||||||
|
NAVER_REAL_ESTATE_TYPE=APT:ABYG:JGC:PRE
|
||||||
|
NAVER_HEADLESS=1
|
||||||
|
# NAVER_TOKEN_URL= # 기본값(new.land.naver.com houses) 사용
|
||||||
25
services/naver-fetch/Dockerfile
Normal file
25
services/naver-fetch/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
FROM python:3.12-slim-bookworm
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Chromium 런타임 deps (Debian 12 / bookworm) — insta-render 관례
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates tzdata fonts-noto-cjk \
|
||||||
|
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 naver-fetch/requirements.txt /app/
|
||||||
|
RUN pip install --no-cache-dir --timeout 600 --retries 5 -r requirements.txt
|
||||||
|
RUN playwright install chromium
|
||||||
|
|
||||||
|
# 공통 모듈 (services/_shared) — 빌드 컨텍스트 . 필요 (task-watcher 함정)
|
||||||
|
COPY _shared /app/_shared
|
||||||
|
COPY naver-fetch/. /app/
|
||||||
|
ENV PYTHONPATH=/app
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
||||||
Reference in New Issue
Block a user