RESTAPI_SERVER/Dockerfile.simple

32 lines
742 B
Docker

# 간단한 Node.js 기반 Dockerfile (Oracle Instant Client 없이)
FROM node:18-alpine
# 작업 디렉토리 설정
WORKDIR /app
# 의존성 파일 복사
COPY package*.json ./
# 의존성 설치
RUN npm ci --only=production && npm cache clean --force
# 애플리케이션 코드 복사
COPY . .
# 포트 노출
EXPOSE 5577
# 비root 사용자 생성 및 권한 설정
RUN addgroup -g 1001 -S nodejs && \
adduser -S restapi -u 1001 -G nodejs && \
chown -R restapi:nodejs /app
USER restapi
# 헬스체크 추가
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:5577/api/health || exit 1
# 애플리케이션 실행
CMD ["node", "server.js"]