-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b056165
commit 4bfc014
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 베이스 이미지로 Ubuntu 20.04.2 LTS 사용 | ||
FROM ubuntu:20.04 | ||
|
||
# 비대화면 패키지 설치 중 사용자 입력 대기를 방지 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Java 17 설치를 위한 PPA 추가 및 패키지 설치 | ||
RUN apt-get update && apt-get install -y \ | ||
software-properties-common \ | ||
&& add-apt-repository -y ppa:openjdk-r/ppa \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
openjdk-17-jdk \ | ||
maven \ | ||
git \ | ||
mysql-server \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# MySQL 설정 (주의: 실제 프로덕션 환경에서는 보안을 강화해야 합니다.) | ||
RUN service mysql start && \ | ||
mysql -e "CREATE DATABASE IF NOT EXISTS mydb;" && \ | ||
mysql -e "CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';" && \ | ||
mysql -e "GRANT ALL PRIVILEGES ON mydb.* TO 'user'@'localhost';" && \ | ||
mysql -e "FLUSH PRIVILEGES;" | ||
|
||
# 작업 디렉토리 설정 | ||
WORKDIR /app | ||
|
||
# 애플리케이션 소스 추가 | ||
COPY . /app | ||
|
||
# Maven을 사용하여 애플리케이션 빌드 | ||
RUN mvn clean package | ||
|
||
# 애플리케이션 실행 | ||
CMD ["java", "-jar", "target/myapp-0.0.1-SNAPSHOT.jar"] | ||
|
||
# 포트 열기 | ||
EXPOSE 8080 |