📋 프로젝트 빌드 및 절차 변경사항 정리

🔧 전체 빌드 프로세스

graph TD A[프론트엔드 빌드] --> B[static 디렉토리에 배치] B --> C[Spring Boot 빌드] C --> D[WAR 파일 생성] D --> E[서버 배포]

🚀 단계별 빌드 프로세스

1단계: 프론트엔드 빌드

# 1. 프로젝트 루트에서 Spring Boot용 빌드 실행
cd /path/to/home/amano-dx-frontend
./build-for-spring.sh

# 빌드 결과
# ✅ apps/dx-service/out/ - 정적 파일들
# ✅ apps/dx-service/dx-service-build.tar.gz - 배포용 압축 파일이 생성됨

' 빌드 스크립트 ' 설명

2단계: 프론트엔드 빌드 파일 복사

"dx-service-build.tar.gz" 파일을 프론트엔드 프로젝트에서 백엔드 프로젝트로 복사

cp /path/to/home/amano-dx-frontend/apps/dx-service/dx-service-build.tar.gz /path/to/home/amano-dx-backend/DxService/.

3단계: 프론트엔드 파일 배치

cd /path/to/home/amano-dx-backend/DxService

rm -rf src/main/resources/static/*

tar -xzf dx-service-build.tar.gz -C src/main/resources/static/

4단계: 통합 빌드 실행

cd /path/to/home/amano-dx-backend
chmod +x build.sh
./build.sh

5단계: 빌드 결과 확인

6단계: 서비스 실행

java -jar DxService-0.0.1-SNAPSHOT.war

🔧 Frontend 주요 변경사항

1. Next.js 정적 빌드 설정

파일: next.config.js

// Spring Boot 배포를 위한 설정
output: 'export',           // 정적 파일로 export
trailingSlash: true,        // URL 뒤에 / 추가
distDir: 'out',            // 빌드 출력 디렉토리
images: { unoptimized: true }, // 이미지 최적화 비활성화
eslint: { ignoreDuringBuilds: true },    // 빌드 시 ESLint 무시
typescript: { ignoreBuildErrors: true }, // 빌드 시 TypeScript 오류 무시

2. 환경 변수 통합

새 파일: .env.production

# 모든 API를 8087 포트로 통합
NEXT_PUBLIC_BACKEND_URL=http://localhost:8087
NEXT_PUBLIC_API_BASE_URL=http://localhost:8087
NEXT_PUBLIC_AUTH_API_BASE_URL=http://localhost:8087
# ... 기타 모든 API 엔드포인트

3. 정적 빌드 호환성


🔧 Backend 주요 변경사항

1. 프론트엔드 통합 설정

2. Spring Boot 설정 수정 (application.yml)

# 프로덕션 환경 정적 리소스 설정 추가
web:
  resources:
    static-locations: classpath:/static/
    add-mappings: true
mvc:
  static-path-pattern: /**

# CORS 설정 추가 (프론트엔드 API 호출 지원)
management:
  endpoints:
    web:
      cors:
        allowed-origins: "*"
        allowed-methods: GET,POST,PUT,DELETE,OPTIONS
        allowed-headers: "*"

3. .gitignore 업데이트

# Next.js 빌드 파일 제외
DxService/src/main/resources/static/_next/
DxService/src/main/resources/static/

4. WebConfig.java 신규 생성


# END #