48 lines
1.2 KiB
Docker
48 lines
1.2 KiB
Docker
# Oracle Instant Client 포함 버전
|
|
FROM node:18-slim
|
|
|
|
# 필수 패키지 설치
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
unzip \
|
|
libaio1 \
|
|
wget \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Oracle Instant Client 설치
|
|
WORKDIR /opt/oracle
|
|
RUN curl -o instantclient-basic.zip https://download.oracle.com/otn_software/linux/instantclient/1923000/instantclient-basic-linux.x64-19.23.0.0.0dbru.zip && \
|
|
unzip instantclient-basic.zip && \
|
|
rm instantclient-basic.zip && \
|
|
mv instantclient_19_23 instantclient
|
|
|
|
# 환경 변수 설정
|
|
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH
|
|
ENV PATH=/opt/oracle/instantclient:$PATH
|
|
|
|
# 작업 디렉토리 설정
|
|
WORKDIR /app
|
|
|
|
# 의존성 파일 복사 및 설치
|
|
COPY package*.json ./
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
|
|
# 애플리케이션 코드 복사
|
|
COPY . .
|
|
|
|
# 포트 노출
|
|
EXPOSE 5577
|
|
|
|
# 비root 사용자 생성 및 권한 설정
|
|
RUN groupadd -r nodejs && useradd -r -g nodejs restapi && \
|
|
chown -R restapi:nodejs /app
|
|
|
|
USER restapi
|
|
|
|
# 헬스체크 추가
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:5577/api/health || exit 1
|
|
|
|
# 애플리케이션 실행
|
|
CMD ["node", "server.js"]
|