perf: NAS 도커 빌드 시간 단축 — CPU 전용 torch + 빌드 캐시 마운트
DS1517+(Atom C2538)에서 빌드가 30분 이상 걸리던 원인 두 가지를 제거. 1. PyTorch CPU 전용 휠 사용 (backend) PyPI 기본 torch 휠은 nvidia-cublas/cudnn 등 CUDA 패키지를 수 GB 함께 내려받는데 NAS에는 GPU가 없어 전부 불필요했다. download.pytorch.org/whl/cpu 에서 먼저 설치하면 requirements.txt 의 torch 줄은 충족되어 건너뛴다. ml_ensemble 은 이미 지연 임포트라 동작 동일. 2. pip/npm 캐시를 빌드 간 재사용 (backend, mcp-server, frontend) --no-cache-dir 제거하고 RUN --mount=type=cache 로 전환. requirements.txt 가 바뀌어도 받아둔 휠은 재다운로드하지 않는다. Jenkinsfile 에 DOCKER_BUILDKIT/COMPOSE_DOCKER_CLI_BUILD 추가. 부수: frontend Dockerfile 의 FromAsCasing 경고 정리 (as build → AS build). 세 Dockerfile 모두 docker build --check 통과. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
@@ -9,9 +10,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certifi
|
||||
&& npm install -g @anthropic-ai/claude-code \
|
||||
&& apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Python 의존성 설치
|
||||
# Python 의존성 설치 — pip 캐시를 빌드 간 재사용 (BuildKit 필요)
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 애플리케이션 코드 복사
|
||||
COPY . .
|
||||
|
||||
Reference in New Issue
Block a user