diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index dbcc1ad1..1e109b07 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -2,7 +2,10 @@ name: Develop on: push: - branches: [ "main" ] + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + permissions: contents: read @@ -30,7 +33,7 @@ jobs: run: | cd ./src/main/resources touch ./env.properties - echo "${{ secrets.ENV }}" > ./env.properties + echo "${{ secrets.ENV_DEVELOP }}" > ./env.properties shell: bash # Gradle build (Test 제외) - name: Build with Gradle @@ -41,18 +44,20 @@ jobs: - name: Docker build run: | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} - docker build -t atties_spring . - docker tag atties_spring choo000407/atties_spring:${GITHUB_SHA::7} - docker push choo000407/atties_spring:${GITHUB_SHA::7} + docker build -t atties_dev_spring . + docker tag atties_dev_spring choo000407/atties_dev_spring:${GITHUB_SHA::7} + docker push choo000407/atties_dev_spring:${GITHUB_SHA::7} # Deploy - name: Deploy uses: appleboy/ssh-action@master with: - host: ec2-44-193-163-114.compute-1.amazonaws.com - username: ec2-user - password: ${{ secrets.SSH_PASSWORD }} + host: 43.200.100.183 + username: ubuntu + key: ${{ secrets.SSH_PRIVATE_KEY_DEVELOP }} + passphrase: ${{ secrets.SSH_PASSPHRASE }} + port: 22 envs: GITHUB_SHA script: | - docker pull choo000407/atties_spring:${GITHUB_SHA::7} - docker tag choo000407/atties_spring:${GITHUB_SHA::7} atties_spring - docker-compose up -d + sudo docker pull choo000407/atties_dev_spring:${GITHUB_SHA::7} + sudo docker tag choo000407/atties_dev_spring:${GITHUB_SHA::7} atties_dev_spring + sudo docker-compose up -d diff --git a/src/main/java/com/sptp/backend/aws/service/AwsService.java b/src/main/java/com/sptp/backend/aws/service/AwsService.java index ef362bb7..103ceaf7 100644 --- a/src/main/java/com/sptp/backend/aws/service/AwsService.java +++ b/src/main/java/com/sptp/backend/aws/service/AwsService.java @@ -4,8 +4,8 @@ import com.amazonaws.services.s3.model.CannedAccessControlList; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; -import com.amazonaws.services.s3.model.S3Object; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -19,7 +19,8 @@ public class AwsService { private final AmazonS3Client amazonS3Client; - private final String S3Bucket = "atties-bucket"; + @Value("${aws.storage.name}") + private String S3Bucket; // develop "atties-dev-storage", main "atties-bucket" public void uploadImage(MultipartFile image, String uuid) throws IOException { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f2f45f79..e0791482 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,8 @@ # 배포시 80포트 설정 server: port: 80 +#server: +# port: 8080 spring: