This commit is contained in:
2026-02-06 15:43:43 +09:00
parent 921455749e
commit c47f710da6
2 changed files with 15 additions and 7 deletions

View File

@@ -1,24 +1,32 @@
# 1단계: 빌드 (Node.js)
FROM node:20-alpine AS build
FROM node:20-slim AS build
WORKDIR /app
# 빌드 도구 설치 (sqlite3 등 네이티브 모듈 빌드용)
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
COPY package*.json ./
RUN rm -f package-lock.json && npm install
COPY . .
RUN npm run build
# 2단계: 실행 (Nginx)
# 2단계: 실행 (Node.js)
FROM node:20-alpine
# 2단계: 실행 (Node.js - Debian Slim)
FROM node:20-slim
WORKDIR /app
# 런타임 의존성 설치 (필요시)
# RUN apt-get update && apt-get install -y ... && rm -rf /var/lib/apt/lists/*
# 프로덕션 의존성만 설치
COPY package*.json ./
RUN npm install --omit=dev
# 빌드 결과물 복사
COPY --from=build /app/dist ./dist
COPY server.js .
# 환경변수 포트 노출
# 환경변수 포트 노출 (Dokploy 등에서 PORT 주입 시 사용됨)
ENV PORT=80
EXPOSE 80
# 서버 실행

View File

@@ -101,7 +101,7 @@ app.get(/.*/, (req, res) => {
});
initializeDB().then(() => {
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server running on http://0.0.0.0:${PORT}`);
});
});