Skip to content

Commit 86ee330

Browse files
committed
feat: Set up GitHub Actions for Azure Web App deployment and create backend requirements.txt.
1 parent b828a43 commit 86ee330

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

.github/workflows/main_gymbro.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
permissions:
17-
contents: read #This is required for actions/checkout
17+
contents: read
1818

1919
steps:
2020
- uses: actions/checkout@v4
@@ -24,45 +24,38 @@ jobs:
2424
with:
2525
python-version: '3.11'
2626

27-
# 🛠️ Local Build Section (Optional)
28-
# The following section in your workflow is designed to catch build issues early on the client side, before deployment. This can be helpful for debugging and validation. However, if this step significantly increases deployment time and early detection is not critical for your workflow, you may remove this section to streamline the deployment process.
29-
- name: Create and Start virtual environment and Install dependencies
27+
- name: Install dependencies
3028
working-directory: ./backend
3129
run: |
3230
python -m venv antenv
3331
source antenv/bin/activate
3432
pip install -r requirements.txt
35-
36-
# By default, when you enable GitHub CI/CD integration through the Azure portal, the platform automatically sets the SCM_DO_BUILD_DURING_DEPLOYMENT application setting to true. This triggers the use of Oryx, a build engine that handles application compilation and dependency installation (e.g., pip install) directly on the platform during deployment. Hence, we exclude the antenv virtual environment directory from the deployment artifact to reduce the payload size.
33+
34+
- name: Prepare deployment package
35+
run: |
36+
mkdir deploy
37+
cp -r backend/* deploy/
38+
rm -rf deploy/antenv deploy/.venv deploy/.env deploy/__pycache__ deploy/.pytest_cache
39+
3740
- name: Upload artifact for deployment jobs
3841
uses: actions/upload-artifact@v4
3942
with:
4043
name: python-app
41-
path: |
42-
./backend
43-
!./backend/antenv/
44-
!./backend/.venv/
45-
!./backend/.env
46-
47-
# 🚫 Opting Out of Oryx Build
48-
# If you prefer to disable the Oryx build process during deployment, follow these steps:
49-
# 1. Remove the SCM_DO_BUILD_DURING_DEPLOYMENT app setting from your Azure App Service Environment variables.
50-
# 2. Refer to sample workflows for alternative deployment strategies: https://github.com/Azure/actions-workflow-samples/tree/master/AppService
51-
44+
path: deploy/
5245

5346
deploy:
5447
runs-on: ubuntu-latest
5548
needs: build
5649
permissions:
57-
id-token: write #This is required for requesting the JWT
58-
contents: read #This is required for actions/checkout
50+
id-token: write
51+
contents: read
5952

6053
steps:
6154
- name: Download artifact from build job
6255
uses: actions/download-artifact@v4
6356
with:
6457
name: python-app
65-
58+
6659
- name: Login to Azure
6760
uses: azure/login@v2
6861
with:
@@ -75,5 +68,4 @@ jobs:
7568
id: deploy-to-webapp
7669
with:
7770
app-name: 'gymbro'
78-
slot-name: 'Production'
79-
71+
slot-name: 'Production'

backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fastapi>=0.109.2
22
uvicorn[standard]>=0.27.1
3+
gunicorn>=21.2.0
34
motor>=3.3.2
45
pymongo>=4.6.1
56
pydantic[email]>=2.6.1

0 commit comments

Comments
 (0)