Skip to content

Commit

Permalink
Update django_CICD.yml
Browse files Browse the repository at this point in the history
디렉토리 확인
  • Loading branch information
2ming00 authored Sep 1, 2024
1 parent 3e72f1b commit c351032
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/django_CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ jobs:
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'
# 서버에서 디렉토리 생성 여부 확인 및 생성
ssh -o StrictHostKeyChecking=no -i key.pem $EC2_USER@$EC2_HOST << EOF
if [ ! -d "/home/ubuntu/aiServer" ]; then
mkdir -p /home/ubuntu/aiServer
fi
echo '{"SECRET_KEY": "'"${SECRET}"'"}' > /home/ubuntu/aiServer/secrets.json
EOF
# 코드 업로드
scp -o StrictHostKeyChecking=no -i key.pem -r ./aiServer $EC2_USER@$EC2_HOST:/home/ubuntu/
# 서버에 접속하여 작업 수행
ssh -o StrictHostKeyChecking=no -i key.pem $EC2_USER@$EC2_HOST <<- 'EOF'
ssh -o StrictHostKeyChecking=no -i key.pem $EC2_USER@$EC2_HOST << EOF
cd /home/ubuntu/aiServer || exit 1
python3 -m venv venv
source venv/bin/activate
Expand Down

0 comments on commit c351032

Please sign in to comment.