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));