From d65f1ef9d1c750b1beeee3f91d23b1c70d16d303 Mon Sep 17 00:00:00 2001 From: Blue Date: Tue, 29 Oct 2024 21:14:30 +0900 Subject: [PATCH] Update Dockerfile --- Dockerfile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 150d21b..a5f1ed2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,23 @@ +# 1. Base image로 AWS CLI를 사용하는 JDK 이미지 사용 FROM amazon/aws-cli -# 필요한 패키지 설치 +# 2. 필요한 패키지 설치 RUN yum update -y && \ yum install -y yum-utils shadow-utils wget tar gzip -# Terraform 설치 +# 3. Terraform 설치 RUN yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo && \ yum install -y terraform -# kubectl 설치 +# 4. kubectl 설치 RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ chmod +x kubectl && \ mv kubectl /usr/local/bin/ -# Amazon Corretto JDK 17 설치 +# 5. Amazon Corretto JDK 17 설치 RUN yum install -y java-17-amazon-corretto-devel -# wget과 unzip 설치 +# 6. wget과 unzip 설치 및 Gradle 다운로드 RUN yum update -y && \ yum install -y wget unzip && \ wget https://services.gradle.org/distributions/gradle-7.6-bin.zip && \ @@ -24,21 +25,22 @@ RUN yum update -y && \ ln -s /opt/gradle-7.6 /opt/gradle && \ rm gradle-7.6-bin.zip -# Gradle 경로 설정 +# 7. Gradle 경로 설정 ENV PATH="/opt/gradle/bin:${PATH}" -# 환경 변수 설정 +# 8. 환경 변수 설정 ENV JAVA_HOME=/usr/lib/jvm/java-17-amazon-corretto ENV GRADLE_HOME=/opt/gradle ENV PATH=${GRADLE_HOME}/bin:${PATH} -# # 작업 디렉토리 생성 +# 9. 작업 디렉토리 생성 WORKDIR /app -# GitHub Actions에서 빌드된 JAR 파일만 복사 +# 10. GitHub Actions에서 빌드된 JAR 파일 복사 COPY build/libs/McpBackend-Terraform-0.0.1-SNAPSHOT.jar /app/terraform.jar +# 11. JAR 파일에 실행 권한 부여 RUN chmod +x /app/terraform.jar -# 컨테이너 시작 시 실행할 명령어 -CMD ["java", "-jar", "/app/terraform.jar"] +# 12. 컨테이너 시작 시 실행할 명령어 +CMD ["sh", "-c", "java -jar /app/terraform.jar"]