백엔드 도커 설정
This commit is contained in:
parent
38216b3ddc
commit
caacd0e0a4
|
|
@ -0,0 +1,51 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
# Base image (Debian-based for glibc + OpenSSL compatibility)
|
||||||
|
FROM node:20-bookworm-slim AS base
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
# Install OpenSSL and required certs
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Dependencies stage (install deps and generate Prisma client)
|
||||||
|
FROM base AS deps
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci --omit=dev && npm cache clean --force
|
||||||
|
# Copy prisma schema and generate client (glibc target will be detected)
|
||||||
|
COPY prisma ./prisma
|
||||||
|
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=true
|
||||||
|
RUN npx prisma generate
|
||||||
|
|
||||||
|
# Build stage (compile TypeScript)
|
||||||
|
FROM node:20-bookworm-slim AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci && npm cache clean --force
|
||||||
|
COPY tsconfig.json ./
|
||||||
|
COPY src ./src
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Runtime image
|
||||||
|
FROM node:20-bookworm-slim AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
# Ensure OpenSSL present
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create non-root user
|
||||||
|
RUN groupadd -r appgroup && useradd -r -g appgroup appuser
|
||||||
|
|
||||||
|
# Copy node_modules with generated Prisma client
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
# Copy built files
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
# Copy package files
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
USER appuser
|
||||||
|
CMD ["node", "dist/app.js"]
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
|
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
|
|
@ -775,7 +776,6 @@ model company_mng {
|
||||||
regdate DateTime? @db.Timestamp(6)
|
regdate DateTime? @db.Timestamp(6)
|
||||||
status String? @db.VarChar(32)
|
status String? @db.VarChar(32)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
||||||
model contract_mgmt {
|
model contract_mgmt {
|
||||||
objid String @id @db.VarChar
|
objid String @id @db.VarChar
|
||||||
|
|
@ -1576,7 +1576,6 @@ model invoice_mgmt {
|
||||||
discount_percentage String? @db.VarChar
|
discount_percentage String? @db.VarChar
|
||||||
inv_discount_price String? @db.VarChar
|
inv_discount_price String? @db.VarChar
|
||||||
}
|
}
|
||||||
|
|
||||||
model invoice_mgmt_part {
|
model invoice_mgmt_part {
|
||||||
objid String @id @db.VarChar
|
objid String @id @db.VarChar
|
||||||
invoice_objid String? @db.VarChar
|
invoice_objid String? @db.VarChar
|
||||||
|
|
@ -2354,7 +2353,6 @@ model part_mng {
|
||||||
|
|
||||||
@@index([part_no])
|
@@index([part_no])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
||||||
model part_mng_del {
|
model part_mng_del {
|
||||||
objid String? @db.VarChar
|
objid String? @db.VarChar
|
||||||
|
|
@ -3148,7 +3146,6 @@ model product_group_mng {
|
||||||
|
|
||||||
@@ignore
|
@@ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
||||||
model product_kind_spec {
|
model product_kind_spec {
|
||||||
objid String @db.VarChar
|
objid String @db.VarChar
|
||||||
|
|
@ -3924,7 +3921,6 @@ model purchase_order_master_240402 {
|
||||||
|
|
||||||
@@ignore
|
@@ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
||||||
model purchase_order_master_240509 {
|
model purchase_order_master_240509 {
|
||||||
objid String? @db.VarChar
|
objid String? @db.VarChar
|
||||||
|
|
@ -4707,7 +4703,6 @@ model sales_bom_report_part {
|
||||||
|
|
||||||
@@index([parent_objid])
|
@@index([parent_objid])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
||||||
model sales_bom_report_part_240422 {
|
model sales_bom_report_part_240422 {
|
||||||
objid String? @db.VarChar
|
objid String? @db.VarChar
|
||||||
|
|
@ -4991,7 +4986,7 @@ model setup_wbs_task {
|
||||||
|
|
||||||
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client.
|
||||||
model setup_wbs_task_standard {
|
model setup_wbs_task_standard {
|
||||||
objid String? @unique(map: "setup_wbs_task_standard _objid_key") @db.VarChar
|
objid String? @unique(map: "setup_wbs_task_standard_objid_key") @db.VarChar
|
||||||
contract_objid String? @db.VarChar
|
contract_objid String? @db.VarChar
|
||||||
parent_objid String? @db.VarChar
|
parent_objid String? @db.VarChar
|
||||||
task_category String? @db.VarChar
|
task_category String? @db.VarChar
|
||||||
|
|
@ -5494,7 +5489,6 @@ model swpc120a_tbl {
|
||||||
|
|
||||||
@@id([imitemid, suvndcd], map: "pk_swpc120a_tbl")
|
@@id([imitemid, suvndcd], map: "pk_swpc120a_tbl")
|
||||||
}
|
}
|
||||||
|
|
||||||
model swpc130a_tbl {
|
model swpc130a_tbl {
|
||||||
imitemid String @db.VarChar(15)
|
imitemid String @db.VarChar(15)
|
||||||
suvndcd String @db.VarChar(5)
|
suvndcd String @db.VarChar(5)
|
||||||
|
|
@ -6254,7 +6248,6 @@ model swsb500a_tbl {
|
||||||
edit_date DateTime? @db.Timestamp(6)
|
edit_date DateTime? @db.Timestamp(6)
|
||||||
edit_emp String? @db.VarChar(30)
|
edit_emp String? @db.VarChar(30)
|
||||||
}
|
}
|
||||||
|
|
||||||
model swsb510a_tbl {
|
model swsb510a_tbl {
|
||||||
frw_req_no String @id(map: "pk_swsb510a_tbl") @db.VarChar(10)
|
frw_req_no String @id(map: "pk_swsb510a_tbl") @db.VarChar(10)
|
||||||
req_date String? @db.VarChar(8)
|
req_date String? @db.VarChar(8)
|
||||||
|
|
@ -6842,4 +6835,4 @@ model zz_230410_user_info {
|
||||||
fax_no String? @db.VarChar
|
fax_no String? @db.VarChar
|
||||||
|
|
||||||
@@ignore
|
@@ignore
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
version: '3.8'
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Spring Boot 백엔드만
|
# Node.js 백엔드
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend-node
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: pms-backend-linux
|
container_name: pms-backend-linux
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
environment:
|
environment:
|
||||||
- SPRING_PROFILES_ACTIVE=dev
|
- NODE_ENV=development
|
||||||
- SPRING_DATASOURCE_URL=jdbc:postgresql://39.117.244.52:11132/plm?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
|
- PORT=8080
|
||||||
- SPRING_DATASOURCE_USERNAME=postgres
|
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
|
||||||
- SPRING_DATASOURCE_PASSWORD=ph0909!!
|
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
|
||||||
- LANG=ko_KR.UTF-8
|
- JWT_EXPIRES_IN=24h
|
||||||
- LANGUAGE=ko_KR:ko
|
- CORS_ORIGIN=http://localhost:9771
|
||||||
- LC_ALL=ko_KR.UTF-8
|
- CORS_CREDENTIALS=true
|
||||||
- TZ=Asia/Seoul
|
- LOG_LEVEL=debug
|
||||||
- JAVA_OPTS=-Xms512m -Xmx1024m -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Seoul -Djava.awt.headless=true
|
volumes:
|
||||||
|
- ./backend-node:/app
|
||||||
|
- /app/node_modules
|
||||||
networks:
|
networks:
|
||||||
- pms-network
|
- pms-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/actuator/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
@ -31,4 +33,4 @@ services:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
pms-network:
|
pms-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
version: '3.8'
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Spring Boot 백엔드만
|
# Node.js 백엔드
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend-node
|
||||||
dockerfile: Dockerfile.mac
|
dockerfile: Dockerfile
|
||||||
container_name: pms-backend-mac
|
container_name: pms-backend-mac
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
environment:
|
environment:
|
||||||
- SPRING_PROFILES_ACTIVE=dev
|
- NODE_ENV=development
|
||||||
- SPRING_DATASOURCE_URL=jdbc:postgresql://39.117.244.52:11132/plm?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
|
- PORT=8080
|
||||||
- SPRING_DATASOURCE_USERNAME=postgres
|
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
|
||||||
- SPRING_DATASOURCE_PASSWORD=ph0909!!
|
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
|
||||||
- LANG=ko_KR.UTF-8
|
- JWT_EXPIRES_IN=24h
|
||||||
- LANGUAGE=ko_KR:ko
|
- CORS_ORIGIN=http://localhost:9771
|
||||||
- LC_ALL=ko_KR.UTF-8
|
- CORS_CREDENTIALS=true
|
||||||
- TZ=Asia/Seoul
|
- LOG_LEVEL=debug
|
||||||
- JAVA_OPTS=-Xms512m -Xmx1024m -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Seoul -Djava.awt.headless=true
|
volumes:
|
||||||
|
- ./backend-node:/app
|
||||||
|
- /app/node_modules
|
||||||
networks:
|
networks:
|
||||||
- pms-network
|
- pms-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/actuator/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
@ -31,4 +33,4 @@ services:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
pms-network:
|
pms-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Spring Boot 백엔드만
|
# Node.js 백엔드
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend-node
|
||||||
dockerfile: Dockerfile.mac
|
dockerfile: Dockerfile
|
||||||
container_name: pms-backend-win
|
container_name: pms-backend-win
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
environment:
|
environment:
|
||||||
- SPRING_PROFILES_ACTIVE=dev
|
- NODE_ENV=development
|
||||||
- SPRING_DATASOURCE_URL=jdbc:postgresql://39.117.244.52:11132/plm?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
|
- PORT=8080
|
||||||
- SPRING_DATASOURCE_USERNAME=postgres
|
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
|
||||||
- SPRING_DATASOURCE_PASSWORD=ph0909!!
|
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
|
||||||
- LANG=ko_KR.UTF-8
|
- JWT_EXPIRES_IN=24h
|
||||||
- LANGUAGE=ko_KR:ko
|
- CORS_ORIGIN=http://localhost:9771
|
||||||
- LC_ALL=ko_KR.UTF-8
|
- CORS_CREDENTIALS=true
|
||||||
- TZ=Asia/Seoul
|
- LOG_LEVEL=debug
|
||||||
- JAVA_OPTS=-Xms512m -Xmx1024m -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Seoul -Djava.awt.headless=true
|
volumes:
|
||||||
|
- ./backend-node:/app
|
||||||
|
- /app/node_modules
|
||||||
networks:
|
networks:
|
||||||
- pms-network
|
- pms-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/actuator/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "ERP-node",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
|
|
@ -5,12 +5,12 @@ echo "PLM 솔루션 - 전체 서비스 시작 (분리형)"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "🚀 백엔드와 프론트엔드를 순차적으로 시작합니다..."
|
echo "🚀 백엔드(Node.js)와 프론트엔드(Next.js)를 순차적으로 시작합니다..."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 백엔드 먼저 시작
|
# 백엔드 먼저 시작
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo "1. 백엔드 서비스 시작 중..."
|
echo "1. 백엔드 서비스 시작 중... (Node.js)"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
|
|
||||||
docker-compose -f docker-compose.backend.mac.yml build --no-cache
|
docker-compose -f docker-compose.backend.mac.yml build --no-cache
|
||||||
|
|
@ -25,7 +25,7 @@ sleep 20
|
||||||
# 프론트엔드 시작
|
# 프론트엔드 시작
|
||||||
echo ""
|
echo ""
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo "2. 프론트엔드 서비스 시작 중..."
|
echo "2. 프론트엔드 서비스 시작 중... (Next.js)"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
|
|
||||||
docker-compose -f docker-compose.frontend.mac.yml build --no-cache
|
docker-compose -f docker-compose.frontend.mac.yml build --no-cache
|
||||||
|
|
@ -42,7 +42,7 @@ echo "🎉 모든 서비스가 시작되었습니다!"
|
||||||
echo "============================================"
|
echo "============================================"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[DATABASE] PostgreSQL: http://39.117.244.52:11132"
|
echo "[DATABASE] PostgreSQL: http://39.117.244.52:11132"
|
||||||
echo "[BACKEND] Spring Boot: http://localhost:8080/api"
|
echo "[BACKEND] Node.js API: http://localhost:8080/api"
|
||||||
echo "[FRONTEND] Next.js: http://localhost:9771"
|
echo "[FRONTEND] Next.js: http://localhost:9771"
|
||||||
echo ""
|
echo ""
|
||||||
echo "서비스 상태 확인:"
|
echo "서비스 상태 확인:"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue