Deploy fastAPI app to docker hub by dkimds #40
This file contains hidden or 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
| name: Deploy fastAPI app | |
| run-name: Deploy fastAPI app to docker hub by ${{github.actor}} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Remove old files | |
| uses: appleboy/ssh-action@v1.2.2 | |
| with: | |
| host: ${{ secrets.AI_SERVER_HOST }} | |
| username: ${{ secrets.AI_SERVER_USERNAME }} | |
| key: ${{ secrets.AI_SERVER_KEY }} | |
| port: ${{ secrets.AI_SERVER_PORT }} | |
| script: | | |
| # 폴더 새로 생성 | |
| sudo rm -rf ~/chatbot || true | |
| mkdir ~/chatbot | |
| - name: Copy files via SSH | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.AI_SERVER_HOST }} | |
| username: ${{ secrets.AI_SERVER_USERNAME }} | |
| key: ${{ secrets.AI_SERVER_KEY }} | |
| port: ${{ secrets.AI_SERVER_PORT }} | |
| source: "." | |
| target: "~/chatbot" | |
| - name: Start chatbot service | |
| uses: appleboy/ssh-action@v1.2.2 | |
| with: | |
| host: ${{ secrets.AI_SERVER_HOST }} | |
| username: ${{ secrets.AI_SERVER_USERNAME }} | |
| key: ${{ secrets.AI_SERVER_KEY }} | |
| port: ${{ secrets.AI_SERVER_PORT }} | |
| script: | | |
| cd ~/chatbot | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| pip install -r requirements.txt | |
| echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" > .env | |
| echo "TAVILY_API_KEY=${{ secrets.TAVILY_API_KEY }}" >> .env | |
| echo "MILVUS_URI=http://localhost:19530" >> .env | |
| sudo chmod +x ./standalone_embed.sh | |
| ./standalone_embed.sh | |
| sudo chmod +x ./dependency.sh | |
| ./dependency.sh | |
| # uses: actions/checkout@v4 | |
| # - name: Create env file | |
| # run: | | |
| # echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" > .env | |
| # echo "TAVILY_KEY=${{ secrets.TAVILY_KEY }}" >> .env | |
| # - name: Build image | |
| # run: | | |
| # docker build -t ${{secrets.DOCKER_USERNAME}}/if-ai:latest . | |
| # - name: Login to Docker Hub | |
| # uses: docker/login-action@v3.4.0 | |
| # with: | |
| # username: ${{secrets.DOCKER_USERNAME}} | |
| # password: ${{secrets.DOCKER_TOKEN}} | |
| # - name: Push image to Docker hub | |
| # run: | | |
| # docker push ${{secrets.DOCKER_USERNAME}}/if-ai:latest |