Skip to content

Commit f3dc551

Browse files
authored
Merge pull request #360 from KW-ClassLog/Chore/#356/fix-cd-pipeline
📦 Chore/#356 CD 파이프라인 수정
2 parents 9634d05 + a58767b commit f3dc551

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

.github/workflows/CD.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,28 @@ jobs:
100100
NEXT_PUBLIC_API_BASE_URL=${{secrets.NEXT_PUBLIC_API_BASE_URL}}
101101
NEXT_PUBLIC_WS_URL=${{secrets.NEXT_PUBLIC_WS_URL}}
102102
EOF
103+
104+
- name: Create .env for docker compose
105+
uses: appleboy/[email protected]
106+
with:
107+
host: ${{ secrets.SSH_HOST }}
108+
username: ${{ secrets.SSH_USER }}
109+
key: ${{ secrets.SSH_KEY }}
110+
script: |
111+
mkdir -p /home/ubuntu/classlog
112+
cat > /home/ubuntu/classlog/.env <<EOF
113+
DOCKERHUB_USERNAME=${{ secrets.DOCKER_USERNAME }}
114+
IMAGE_TAG=${{ github.sha }}
115+
EOF
116+
103117
- name: Deploy containers
104118
uses: appleboy/[email protected]
105119
with:
106120
host: ${{ secrets.SSH_HOST }}
107121
username: ${{ secrets.SSH_USER }}
108122
key: ${{ secrets.SSH_KEY }}
109123
script: |
110-
cd /home/ubuntu/classlog
111-
export DOCKERHUB_USERNAME="${{ secrets.DOCKER_USERNAME }}"
112-
export IMAGE_TAG="${{ github.sha }}"
113-
114-
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
124+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
115125
docker compose down
116126
docker compose pull
117127
docker compose up -d

0 commit comments

Comments
 (0)