Docker 파일

This commit is contained in:
2025-12-28 13:56:41 +09:00
parent 716f4f8791
commit d315b737c7
2 changed files with 38 additions and 15 deletions

View File

@@ -1,15 +0,0 @@
# 환경 설정
# development: 로컬 개발 (스케줄러 수동)
# production: 운영 서버 (스케줄러 자동)
NODE_ENV=development
# PostgreSQL 연결 정보
DB_HOST=localhost
DB_PORT=5432
DB_NAME=osolit_monitor
DB_USER=postgres
DB_PASSWORD=your_password
# 스케줄러 자동시작 여부 (true/false)
# 생략 시: production=true, development=false
AUTO_START_SCHEDULER=false

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# ===========================================
# Osolit Monitor - Production Dockerfile
# ===========================================
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
COPY .env.prod .env
RUN npm run build
FROM node:20-alpine
WORKDIR /app
# 타임존 설정
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Seoul /etc/localtime \
&& echo "Asia/Seoul" > /etc/timezone \
&& apk del tzdata
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
COPY --from=builder /app/.output /app/.output
RUN addgroup -g 1001 -S nodejs \
&& adduser -S nuxt -u 1001 -G nodejs \
&& chown -R nuxt:nodejs /app
USER nuxt
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
CMD ["node", ".output/server/index.mjs"]