FROM node:18-alpine WORKDIR /usr/src/app # shared 모듈 복사 COPY shared/ ./shared/ # 패키지 파일 복사 + 프로덕션 의존성 설치 (sharp용 빌드 도구 포함) COPY system1-factory/api/package*.json ./ RUN apk add --no-cache --virtual .build-deps python3 make g++ && \ npm install --omit=dev && \ npm install sharp && \ apk del .build-deps # 앱 소스 복사 COPY system1-factory/api/ ./ # 로그/업로드 디렉토리 생성 RUN mkdir -p logs uploads/issues uploads/equipments uploads/purchase_requests RUN chown -R node:node /usr/src/app USER node EXPOSE 3005 HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \ CMD node -e "require('http').get('http://localhost:3005/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); })" CMD ["node", "index.js"]