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