Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,60 +140,3 @@ jobs:
labels: ${{ steps.meta-backend.outputs.labels }}
cache-from: type=registry,ref=shawnjensen/devops-group-c-fall2025-backend:buildcache
cache-to: type=registry,ref=shawnjensen/devops-group-c-fall2025-backend:buildcache,mode=max

# Deploy to AWS EC2 (optional, triggered manually or after successful build)
deploy-to-ec2:
runs-on: ubuntu-latest
needs: [build-and-push]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
aws-region: us-west-2

- name: Deploy to EC2 via SSH
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
# Pull latest images
docker pull shawnjensen/devops-group-c-fall2025-frontend:latest
docker pull shawnjensen/devops-group-c-fall2025-backend:latest

# Stop and remove old containers
docker stop frontend backend || true
docker rm frontend backend || true

# Run new containers
docker run -d \
--name backend \
-p 5000:5000 \
-e SUPABASE_URL=${{ secrets.SUPABASE_URL }} \
-e SUPABASE_KEY=${{ secrets.SUPABASE_KEY }} \
-e PORT=${{ secrets.PORT }} \
shawnjensen/devops-group-c-fall2025-backend:latest

docker run -d \
--name frontend \
-p 80:80 \
-e REACT_APP_BACKEND_URL=http://localhost:5000 \
shawnjensen/devops-group-c-fall2025-frontend:latest

# Clean up old images
docker image prune -af

- name: Verify deployment
run: |
echo "Deployment completed successfully!"
echo "Frontend should be available at: http://${{ secrets.EC2_HOST }}"
echo "Backend should be available at: http://${{ secrets.EC2_HOST }}:5000"
Loading