-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,12 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create secrets.json | ||
uses: jsdaniell/[email protected] | ||
with: | ||
name: "secrets.json" | ||
json: ${{ secrets.SECRET_JSON }} | ||
|
||
- name: Upload Code to EC2 | ||
env: | ||
EC2_HOST: ${{ secrets.EC2_HOST }} | ||
|
@@ -47,8 +53,9 @@ jobs: | |
fi | ||
EOF | ||
# 코드 업로드 | ||
# 코드 및 secrets.json 업로드 | ||
scp -o StrictHostKeyChecking=no -i key.pem -r ./aiServer $EC2_USER@$EC2_HOST:/home/ubuntu/ | ||
scp -o StrictHostKeyChecking=no -i key.pem ./secrets.json $EC2_USER@$EC2_HOST:/home/ubuntu/aiServer/ | ||
# 사용된 키 삭제 | ||
rm key.pem | ||
|
@@ -66,14 +73,12 @@ jobs: | |
EC2_HOST: ${{ secrets.EC2_HOST }} | ||
EC2_USER: ubuntu | ||
EC2_KEY: ${{ secrets.EC2_KEY }} | ||
SECRET: ${{ secrets.SECRETS }} | ||
run: | | ||
echo "${{ secrets.EC2_KEY }}" > key.pem | ||
chmod 400 key.pem | ||
# 서버에 접속하여 작업 수행 및 secrets.json 파일 생성 | ||
# 서버에 접속하여 작업 수행 | ||
ssh -o StrictHostKeyChecking=no -i key.pem $EC2_USER@$EC2_HOST << EOF | ||
echo '{"SECRET_KEY": "'"${SECRET}"'"}' > /home/ubuntu/aiServer/secrets.json | ||
cd /home/ubuntu/aiServer || exit 1 | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
|