Skip to content

Commit

Permalink
feat(ci): update CI/CD workflows for FastAPI and replace Docker comma…
Browse files Browse the repository at this point in the history
…nds with Docker Compose
  • Loading branch information
shba007 committed Jan 1, 2025
1 parent ed8834b commit 61fd2e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flask CD
name: Fastapi CD
run-name: ${{ github.ref_name }}

on:
Expand Down Expand Up @@ -102,21 +102,6 @@ jobs:
username: ${{ secrets.VPS_USERNAME }}
password: ${{ secrets.VPS_PASSWORD }}
script: |
# Pull new image
docker pull ${{ needs.build_web.outputs.image_name }}
# Stop the existing container
docker stop ${{ needs.build_web.outputs.image_title }} || true
docker rm ${{ needs.build_web.outputs.image_title }} || true
# Create and start new container
docker run --detach \
--name ${{ needs.build_web.outputs.image_title }} \
--restart unless-stopped \
--mount type=bind,source=$(pwd)/${{ needs.build_web.outputs.image_title }}/static,target=/app/static,readonly \
--env-file ~/${{ needs.build_web.outputs.image_title }}/.env.prod \
-p ${{ env.PORT }}:3000 \
${{ needs.build_web.outputs.image_name }}
# Clean up unused images
docker image prune -f
cd ~/${{ needs.build.outputs.image_title }}
curl -O https://raw.githubusercontent.com/${{ env.REPO }}/refs/heads/main/docker-compose.yml
docker compose -f docker-compose.yml up -d
10 changes: 1 addition & 9 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flask CI
name: Fastapi CI

on:
push:
Expand Down Expand Up @@ -41,11 +41,3 @@ jobs:

- name: Format Code
run: uv run task format

- name: Create Release Pull Request
uses: changesets/action@v1
with:
title: 'chore(release): update version'
commit: 'chore(release): update version'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 61fd2e7

Please sign in to comment.