Skip to content

Commit

Permalink
MATE-141 : [FEAT] 도커파일에 환경변수 전달 (#122)
Browse files Browse the repository at this point in the history
* MATE-141 : [FEAT] 도커파일에 환경변수 전달

* MATE-141 : [FEAT] 스크립트 파일 실행 권한 부여

- 1. CodeDeploy가 배포할 때 자동으로 start-server.sh에 실행 권한을 부여
  • Loading branch information
juchan204 authored Jan 2, 2025
1 parent 61d4456 commit 9b41169
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ files:
# EC2의 어떤 경로에 저장할 지 지정한다.
destination: /home/ubuntu/WEB1_2_PitchingMate_BE


permissions:
- object: /
owner: ubuntu
group: ubuntu
- object: /home/ubuntu/WEB1_2_PitchingMate_BE/scripts/start-server.sh
mode: 755
owner: ubuntu
group: ubuntu

hooks:
ApplicationStart:
Expand Down
9 changes: 7 additions & 2 deletions scripts/start-server.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/bash

#!/bin/bash
echo "--------------- 서버 배포 시작 -----------------"
docker stop catchmi-server || true
docker rm catchmi-server || true
docker pull 533267244952.dkr.ecr.ap-northeast-2.amazonaws.com/catchmi-server:latest
docker run -d --name catchmi-server \
docker run -d \
--name catchmi-server \
--restart unless-stopped \
-p 8080:8080 \
-e TZ=Asia/Seoul \
-e JWT_SECRET_KEY="${JWT_SECRET_KEY}" \
-e NAVER_CLIENT_ID="${NAVER_CLIENT_ID}" \
-e NAVER_REDIRECT_URI="${NAVER_REDIRECT_URI}" \
-e NAVER_CLIENT_SECRET="${NAVER_CLIENT_SECRET}" \
-e OPENWEATHER_API_KEY="${OPENWEATHER_API_KEY}" \
-e S3_BUCKET_NAME="${S3_BUCKET_NAME}" \
-e IAM_ACCESS_KEY="${IAM_ACCESS_KEY}" \
-e IAM_SECRET_KEY="${IAM_SECRET_KEY}" \
533267244952.dkr.ecr.ap-northeast-2.amazonaws.com/catchmi-server:latest
echo "--------------- 서버 배포 끝 -----------------"

0 comments on commit 9b41169

Please sign in to comment.