-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
name: Build and Deploy Flask App | ||
name: Flask CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
branches: [main] | ||
|
||
jobs: | ||
build-and-deploy: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
python-version: 3.8 | ||
|
||
- name: Create virtual environment | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r requirements.txt | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
- name: Build and deploy | ||
env: | ||
FLASK_APP: app.py | ||
FLASK_ENV: production | ||
- name: Print debugging information | ||
run: | | ||
flask build | ||
docker build -t my-flask-app . | ||
docker tag my-flask-app:latest $(docker images | grep my-flask-app | cut -d : -f 1) | ||
docker push my-flask-app:latest | ||
echo "Python Version: $(python --version)" | ||
echo "Working Directory: $(pwd)" | ||
echo "Contents of Working Directory: $(ls -l)" | ||
echo "Contents of site-packages: $(ls -l venv/lib/python*/site-packages)" | ||
- name: Run tests | ||
run: python test_hello.py |