From a0f1fb7cf71658ac5b575179d06150a77d79791c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?toni=20=28=EC=9D=B4=EC=86=8C=EC=9D=80=29?= <144209738+saokiritoni@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:48:06 +0900 Subject: [PATCH] =?UTF-8?q?Chore:=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a1633f..340a164 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,15 +41,9 @@ jobs: restore-keys: | gradle-${{ runner.os }}- - # Gradle 빌드 - name: Build with Gradle Wrapper run: ./gradlew build - # 빌드 후 JAR 파일 이름 변경 (app.jar로 통일) - - name: Rename JAR file - run: | - mv build/libs/*.jar build/libs/app.jar - # Docker 빌드 및 Docker Hub에 푸시 - name: Docker build & push to Docker Hub run: | @@ -74,22 +68,14 @@ jobs: sudo docker rm docker-test fi - # 새 컨테이너 실행 및 application.yml 확인 - sudo docker run -d --name docker-test -p 8080:8080 \ - -e DB_URL=${{ secrets.DB_URL }} \ - -e DB_USERNAME=${{ secrets.DB_USERNAME }} \ - -e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \ - -e REDIS_HOST=${{ secrets.REDIS_HOST }} \ - -e REDIS_PORT=${{ secrets.REDIS_PORT }} \ - -e SMTP_HOST=${{ secrets.SMTP_HOST }} \ - -e SMTP_PORT=${{ secrets.SMTP_PORT }} \ - -e SMTP_USERNAME=${{ secrets.SMTP_USERNAME }} \ - -e SMTP_PASSWORD=${{ secrets.SMTP_PASSWORD }} \ - ${{ secrets.DOCKER_USERNAME }}/docker-test:latest \ - sh -c "ls /app/resources/application.yml && cat /app/resources/application.yml && java -jar /app/app.jar" + # 새 컨테이너 실행 및 환경 변수 전달 + sudo docker run -d --log-driver=syslog --name docker-test -p 8080:8080 \ + --env-file ~/.env \ + ${{ secrets.DOCKER_USERNAME }}/docker-test:latest # 실행 중인 컨테이너 확인 sudo docker ps -a | grep "docker-test" # 사용하지 않는 이미지 및 컨테이너 정리 sudo docker image prune -a -f +