From d315b737c748d48c6cef470b7f9280b29c960cd0 Mon Sep 17 00:00:00 2001 From: Hyoseong Jo Date: Sun, 28 Dec 2025 13:56:41 +0900 Subject: [PATCH] =?UTF-8?q?Docker=20=ED=8C=8C=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 15 --------------- Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 15 deletions(-) delete mode 100644 .env.example create mode 100644 Dockerfile diff --git a/.env.example b/.env.example deleted file mode 100644 index 1926998..0000000 --- a/.env.example +++ /dev/null @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..89423e1 --- /dev/null +++ b/Dockerfile @@ -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"]