-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (115 loc) · 5.77 KB
/
Copy pathdocker-compose.yml
File metadata and controls
122 lines (115 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Java-Tomcat-Oracle 이관 데모 — Docker Compose
# 프로젝트명 고정 (한글 디렉터리명으로 인한 빈 프로젝트명 파싱 오류 방지)
#
# 기동 방법:
# 부트스트랩(Oracle만): docker compose up oracle
# 앱 전체 기동: docker compose --profile app up
# Angular 빌드(1회성): docker compose --profile build run --rm angular-build
#
# .env.example → .env 복사 후 비밀번호 설정 필수
# cp .env.example .env
name: oracle-migration-demo
services:
# ─────────────────────────────────────────
# Oracle XE 11g — 항상 기동 (기본 profile)
# ─────────────────────────────────────────
oracle:
# ★ regular 이미지 사용(slim 아님). slim 변종은 Data Pump 메타데이터 XSL
# 스타일시트를 제거해 expdp/impdp 가 ORA-39213(Metadata processing is not
# available)로 실패한다. 공고 핵심 역량인 DMP 복원(expdp/impdp)을 위해
# Data Pump 를 지원하는 regular 이미지를 사용한다.
image: gvenzl/oracle-xe:11
container_name: oracle
ports:
- "1521:1521"
environment:
ORACLE_PASSWORD: ${ORACLE_PASSWORD}
APP_USER: ${APP_USER:-appuser}
APP_USER_PASSWORD: ${APP_USER_PASSWORD}
volumes:
# oradata: 영속 볼륨 (재기동 시 데이터 보존)
- oradata:/opt/oracle/oradata
# init SQL: 첫 기동에만 자동 실행 — 정식 경로 (오타 금지)
- ./oracle/init:/container-entrypoint-initdb.d:ro
shm_size: 2gb
healthcheck:
test: ["CMD-SHELL", "echo 'SELECT 1 FROM dual;' | sqlplus -S system/${ORACLE_PASSWORD}@//localhost:1521/XE || exit 1"]
interval: 30s
timeout: 20s
retries: 10
start_period: 120s
# ─────────────────────────────────────────
# Tomcat 8.5 + JDK8 — profile: app
# ─────────────────────────────────────────
tomcat:
image: tomcat:8.5-jdk8
container_name: tomcat
profiles:
- app
ports:
# 컨테이너 내부는 항상 8080(nginx 는 compose 네트워크로 tomcat:8080 접근).
# 호스트 포트만 가변화: 8080 이 점유된 환경에서 TOMCAT_HOST_PORT 로 회피.
- "${TOMCAT_HOST_PORT:-8080}:8080"
depends_on:
oracle:
condition: service_healthy
environment:
# JDBC 직결 폴백(System.getenv) + setenv.sh 의 -DAPP_USER_PASSWORD 승격용.
# 후자가 context.xml 의 JNDI password="${APP_USER_PASSWORD}" 를 치환한다.
APP_USER_PASSWORD: ${APP_USER_PASSWORD}
volumes:
# WAR 배포: 단일 .war 파일만 ROOT.war 로 마운트(context=/).
# - 디렉터리 전체(:ro)를 webapps 에 마운트하면 Tomcat 이 압축해제를 못 하고
# target 하위 잡파일까지 노출됨 → .war 파일 1개만 :ro 로 마운트.
# - ROOT.war ⇒ context path '/' ⇒ /api/members 가 루트에서 서빙(프록시 단순화).
- ./backend/target/migration.war:/usr/local/tomcat/webapps/ROOT.war:ro
# ojdbc8.jar — 단일 파일만 lib 에 추가(디렉터리 전체 마운트 시 Tomcat
# 자체 JAR(catalina.jar 등)을 가려 ClassNotFoundException 발생).
# scripts/fetch-ojdbc.sh 로 사전 배치(바이너리 미커밋).
- ./tomcat/lib/ojdbc8.jar:/usr/local/tomcat/lib/ojdbc8.jar:ro
# JNDI DataSource 설정 (Pass-2에서 JDBC→JNDI 전환)
- ./tomcat/context.xml:/usr/local/tomcat/conf/context.xml:ro
# JVM 옵션 (-Xms256m -Xmx512m -XX:MetaspaceSize=128m)
- ./tomcat/setenv.sh:/usr/local/tomcat/bin/setenv.sh:ro
# ─────────────────────────────────────────
# Angular 6 빌드 — profile: build (1회성)
# 실행: docker compose --profile build run --rm angular-build
# ─────────────────────────────────────────
angular-build:
# node:10 — EOL 이미지, sha256 다이제스트로 태그 드리프트 차단
# TODO: digest 미확보 환경에서는 node:10 태그만 사용하고 digest 핀 추가
image: node:10@sha256:59531d2835edd5161c8f9512f9e095b1836f7a1fcb0ab73e005ec46047384911
container_name: angular-build
profiles:
- build
working_dir: /app
command: sh -c "npm ci && npx ng build --prod"
volumes:
# 소스 마운트 (read) + dist 출력 (write)
- ./frontend:/app
# ─────────────────────────────────────────
# Nginx — profile: app
# ─────────────────────────────────────────
nginx:
image: nginx:stable
container_name: nginx
profiles:
- app
ports:
- "443:443"
- "80:80"
depends_on:
- tomcat
volumes:
# Angular 빌드 산출물 (ng build --prod)
- ./frontend/dist:/usr/share/nginx/html:ro
# Nginx 설정 (SSL, proxy_pass → tomcat:8080, SPA try_files)
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
# 자체서명 인증서 — scripts/gen-cert.sh 로 재현 (gitignore)
- ./nginx/certs:/etc/nginx/certs:ro
# ─────────────────────────────────────────
# Named Volumes
# ─────────────────────────────────────────
volumes:
oradata:
driver: local