-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "fix/#111 CD 워크플로 실행 버그 픽스" #113
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,16 +1,11 @@ | ||||||||||
name: Build and Deploy to Dev Server | ||||||||||
|
||||||||||
on: | ||||||||||
push: | ||||||||||
branches: | ||||||||||
- develop | ||||||||||
workflow_dispatch: | ||||||||||
|
||||||||||
jobs: | ||||||||||
build-docker-image: | ||||||||||
runs-on: ubuntu-latest | ||||||||||
environment: dev | ||||||||||
|
||||||||||
steps: | ||||||||||
- name: get repo from github | ||||||||||
uses: actions/checkout@v3 | ||||||||||
|
@@ -38,27 +33,29 @@ jobs: | |||||||||
|
||||||||||
# Docker 이미지 빌드 | ||||||||||
- name: Docker image build | ||||||||||
env: | ||||||||||
IMAGE_TAG: ${{ github.sha }} | ||||||||||
run: | | ||||||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-server:${{ github.sha }} . | ||||||||||
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-server:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/aics-server:latest | ||||||||||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:$IMAGE_TAG . | ||||||||||
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:$IMAGE_TAG ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest | ||||||||||
|
||||||||||
# Docker Hub 이미지 푸시 | ||||||||||
- name: docker Hub push | ||||||||||
run: | | ||||||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-server:${{ github.sha }} | ||||||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-server:latest | ||||||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:$IMAGE_TAG | ||||||||||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest | ||||||||||
Comment on lines
+45
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Docker 푸시 명령어 안전성 개선 필요 변수를 포함한 Docker 푸시 명령어에도 따옴표 처리가 필요합니다. 다음과 같이 수정을 제안드립니다: - docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:$IMAGE_TAG
- docker push ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest
+ docker push "${{ secrets.DOCKERHUB_USERNAME }}/aics-api:$IMAGE_TAG"
+ docker push "${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest" 📝 Committable suggestion
Suggested change
|
||||||||||
|
||||||||||
deploy-to-dev: | ||||||||||
runs-on: ubuntu-latest | ||||||||||
needs: build-docker-image | ||||||||||
steps: | ||||||||||
- name: SSH to server and deploy | ||||||||||
- name: Deploy to dev | ||||||||||
uses: appleboy/[email protected] | ||||||||||
with: | ||||||||||
host: ${{ secrets.SERVER_HOST }} | ||||||||||
username: ${{ secrets.SERVER_USERNAME }} | ||||||||||
password: ${{ secrets.SERVER_PASSWORD }} | ||||||||||
port: ${{ secrets.SERVER_PORT }} | ||||||||||
script: | | ||||||||||
sudo -E docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} pull || exit 1 | ||||||||||
sudo -E docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }} up -d || exit 1 | ||||||||||
sudo docker-compose pull ${{ secrets.DOCKERHUB_USERNAME }}/aics-api:latest | ||||||||||
sudo docker-compose up -d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
쉘 스크립트 안전성 개선 및 이미지 이름 변경 확인 필요
Docker 빌드 명령어에서 변수 사용 시 따옴표 처리가 필요하며, 이미지 이름 변경이 전체 애플리케이션에서 일관되게 적용되었는지 확인이 필요합니다.
다음과 같이 수정을 제안드립니다:
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
38-38: shellcheck reported issue in this script: SC2086:info:1:60: Double quote to prevent globbing and word splitting
(shellcheck)
38-38: shellcheck reported issue in this script: SC2086:info:2:55: Double quote to prevent globbing and word splitting
(shellcheck)