From f03d439a3a86eacd4a7ff8cb0e656f342dfa39cd Mon Sep 17 00:00:00 2001 From: EunChanNam Date: Wed, 29 Nov 2023 13:26:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20yml=20=EC=84=A4=EC=A0=95=20=EC=98=A4?= =?UTF-8?q?=ED=83=88=EC=9E=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 48 +++++++++---------- .../Dockerfile-redis => Dockerfile-redis | 0 .../Dockerfile-server => Dockerfile-server | 0 docker/docker-compose.yml | 8 ++-- .../application/LikeReviewTestService.java | 5 ++ 5 files changed, 34 insertions(+), 27 deletions(-) rename docker/redis/Dockerfile-redis => Dockerfile-redis (100%) rename docker/server/Dockerfile-server => Dockerfile-server (100%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3b85edd..37f3768 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -32,33 +32,33 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: 환경변수 파일 생성 - run: echo "${{ secrets.APPLICATION_ENV }}" > ./.env +# - name: 환경변수 파일 생성 +# run: echo "${{ secrets.APPLICATION_ENV }}" > ./.env +# +# - name: 환경변수 파일을 서버로 전송한다 +# uses: appleboy/scp-action@v0.1.4 +# with: +# host: ${{ secrets.HOST }} +# username: ${{ secrets.USERNAME }} +# key: ${{ secrets.PRIVATE_KEY }} +# port: ${{ secrets.PORT }} +# source: "./.env" +# target: "./" - - name: 환경변수 파일을 서버로 전송한다 - uses: appleboy/scp-action@v0.1.4 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.PRIVATE_KEY }} - port: ${{ secrets.PORT }} - source: "./.env" - target: "./" +# - name: ubuntu Docker image build and push +# run: | +# docker-compose -f ./docker/docker-compose.yml build +# docker-compose -f ./docker/docker-compose.yml push + - name: ubuntu Docker image build + run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -f Dockerfile-server . - - name: ubuntu Docker image build and push - run: | - docker-compose -f ./docker/docker-compose.yml build - docker-compose -f ./docker/docker-compose.yml push -# - name: ubuntu Docker image build -# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -f Dockerfile-server . -# -# - name: Redis Docker image build -# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis -f Dockerfile-redis . + - name: Redis Docker image build + run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis -f Dockerfile-redis . -# - name: ubuntu docker Hub 푸쉬 -# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -# - name: Redis docker Hub 푸쉬 -# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis + - name: ubuntu docker Hub 푸쉬 + run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest + - name: Redis docker Hub 푸쉬 + run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis - name: Deploy with push uses: appleboy/ssh-action@v1.0.0 diff --git a/docker/redis/Dockerfile-redis b/Dockerfile-redis similarity index 100% rename from docker/redis/Dockerfile-redis rename to Dockerfile-redis diff --git a/docker/server/Dockerfile-server b/Dockerfile-server similarity index 100% rename from docker/server/Dockerfile-server rename to Dockerfile-server diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index fe0e49a..6a9c727 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,11 +3,13 @@ services: server: build: context: ./ - dockerfile: server/Dockerfile-server + dockerfile: ../Dockerfile-server image: eunchannam/we-share-wish-hair:latest + platform: linux/amd64 redis: build: context: ./ - dockerfile: redis/Dockerfile-redis - image: eunchannam/we-share-wish-hair:redis \ No newline at end of file + dockerfile: ../Dockerfile-redis + image: eunchannam/we-share-wish-hair:redis + platform: linux/amd64 diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java index a3a6aac..fa7d3c5 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java @@ -1,6 +1,7 @@ package com.inq.wishhair.wesharewishhair.review.application; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.inq.wishhair.wesharewishhair.global.utils.RedisUtils; import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; @@ -17,10 +18,12 @@ public class LikeReviewTestService { private final ReviewFindService reviewFindService; private final RedisUtils redisUtils; + @Transactional(readOnly = true) public long count(Long reviewId) { return likeReviewRepository.countByReviewId(reviewId); } + @Transactional public void clean() { likeReviewRepository.deleteAll(); } @@ -28,6 +31,7 @@ public void clean() { /** * LikeReview 생성 후 Review 에 락걸고 likeCount 변수 update */ + @Transactional public void withLock(Long reviewId, Long userId) { likeReviewRepository.save(LikeReview.addLike(userId, reviewId)); @@ -38,6 +42,7 @@ public void withLock(Long reviewId, Long userId) { /** * 레디스에 좋아요 정보가 없으면 새로 등록하고 있으면 INCR 수행 */ + @Transactional public void withoutLock(Long reviewId, Long userId) { likeReviewRepository.save(LikeReview.addLike(userId, reviewId));