From 4d0d9fd7e697e0e53cbd6c5903d8d9d1d6dbaaf4 Mon Sep 17 00:00:00 2001 From: minsu20 Date: Tue, 5 Mar 2024 03:01:47 +0900 Subject: [PATCH] =?UTF-8?q?deploy:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .deploy/{Dockerfile => dev_dockerfile} | 2 +- .deploy/prod_dockerfile | 16 ++++++++++++++++ .github/workflows/CD-dev.yml | 4 ++-- .github/workflows/CD-prod.yml | 4 ++-- 4 files changed, 21 insertions(+), 5 deletions(-) rename .deploy/{Dockerfile => dev_dockerfile} (83%) create mode 100644 .deploy/prod_dockerfile diff --git a/.deploy/Dockerfile b/.deploy/dev_dockerfile similarity index 83% rename from .deploy/Dockerfile rename to .deploy/dev_dockerfile index 25848cbe..3abad45c 100644 --- a/.deploy/Dockerfile +++ b/.deploy/dev_dockerfile @@ -12,5 +12,5 @@ COPY ${JAR_FILE} app.jar COPY ./build/docs/asciidoc/*.html /static/docs/ # 애플리케이션 실행 시 -cp 옵션을 사용하여 /static/docs 디렉토리를 클래스패스에 추가 -ENTRYPOINT ["java","-cp",".:/static/docs","-jar","/app.jar"] +ENTRYPOINT ["java","-cp",".:/static/docs","-Dspring.profiles.active=dev","-jar","/app.jar"] diff --git a/.deploy/prod_dockerfile b/.deploy/prod_dockerfile new file mode 100644 index 00000000..bff7338e --- /dev/null +++ b/.deploy/prod_dockerfile @@ -0,0 +1,16 @@ +FROM openjdk:11-jdk + +# 타임존 설정 +ENV TZ=Asia/Seoul +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ARG CACHEBREAKER=1 +ARG JAR_FILE=./build/libs/backend-0.0.1-SNAPSHOT.jar +COPY ${JAR_FILE} app.jar + +# 문서를 이미지의 /static/docs 디렉토리에 복사 +COPY ./build/docs/asciidoc/*.html /static/docs/ + +# 애플리케이션 실행 시 -cp 옵션을 사용하여 /static/docs 디렉토리를 클래스패스에 추가 +ENTRYPOINT ["java","-cp",".:/static/docs","-Dspring.profiles.active=prod","-jar","/app.jar"] + diff --git a/.github/workflows/CD-dev.yml b/.github/workflows/CD-dev.yml index 40cd9a33..92a3178b 100644 --- a/.github/workflows/CD-dev.yml +++ b/.github/workflows/CD-dev.yml @@ -85,8 +85,8 @@ jobs: # Docker 이미지 빌드 및 푸시 - name: Docker build run: | - docker build --no-cache -f ./.deploy/Dockerfile -t ${{ secrets.DOCKER_USERNAME_DEV }}/moing_dev:green . - docker build --no-cache -f ./.deploy/Dockerfile -t ${{ secrets.DOCKER_USERNAME_DEV }}/moing_dev:blue . + docker build --no-cache -f ./.deploy/dev_dockerfile -t ${{ secrets.DOCKER_USERNAME_DEV }}/moing_dev:green . + docker build --no-cache -f ./.deploy/dev_dockerfile -t ${{ secrets.DOCKER_USERNAME_DEV }}/moing_dev:blue . - name: Docker Hub Login diff --git a/.github/workflows/CD-prod.yml b/.github/workflows/CD-prod.yml index 2c132f0c..4f211ba4 100644 --- a/.github/workflows/CD-prod.yml +++ b/.github/workflows/CD-prod.yml @@ -85,8 +85,8 @@ jobs: # Docker 이미지 빌드 및 푸시 - name: Docker build run: | - docker build --no-cache -f ./.deploy/Dockerfile -t ${{ secrets.DOCKER_USERNAME_PROD }}/moing_prod:green . - docker build --no-cache -f ./.deploy/Dockerfile -t ${{ secrets.DOCKER_USERNAME_PROD }}/moing_prod:blue . + docker build --no-cache -f ./.deploy/prod_dockerfile -t ${{ secrets.DOCKER_USERNAME_PROD }}/moing_prod:green . + docker build --no-cache -f ./.deploy/prod_dockerfile -t ${{ secrets.DOCKER_USERNAME_PROD }}/moing_prod:blue . - name: Docker Hub Login