File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 pull_request :
77
88jobs :
9- build :
9+ build-and-push :
1010 runs-on : ubuntu-latest
1111
1212 steps :
@@ -18,26 +18,30 @@ jobs:
1818 with :
1919 python-version : " 3.11"
2020
21- # 🔹 Cache pip downloads (speed boost)
2221 - name : Cache pip
2322 uses : actions/cache@v4
2423 with :
2524 path : ~/.cache/pip
2625 key : ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
27- restore-keys : |
28- ${{ runner.os }}-pip-
2926
3027 - name : Install dependencies
3128 run : |
3229 pip install -r requirements.txt
3330
34- - name : Run app import check
31+ - name : Import check
3532 run : |
3633 python -c "import main"
3734
3835 - name : Set up Docker Buildx
3936 uses : docker/setup-buildx-action@v3
4037
41- - name : Build Docker image
38+ - name : Login to Docker Hub
39+ uses : docker/login-action@v3
40+ with :
41+ username : ${{ secrets.DOCKERHUB_USERNAME }}
42+ password : ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+ - name : Build and push image
4245 run : |
43- docker build -t fastapi-app .
46+ docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/fastapi-app:latest .
47+ docker push ${{ secrets.DOCKERHUB_USERNAME }}/fastapi-app:latest
You can’t perform that action at this time.
0 commit comments