Skip to content

Commit a89cfcf

Browse files
added auto docker-hub
1 parent 0bfabe5 commit a89cfcf

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,24 @@ jobs:
2727
- name: run tests with pytest
2828
run: |
2929
pip install pytest
30-
pytest
30+
pytest
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Login to Docker Hub
36+
uses: docker/login-action@v3
37+
with:
38+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
39+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
40+
41+
- name: Build and push Docker image (optimized)
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
push: true
46+
tags: |
47+
${{ secrets.DOCKER_HUB_USERNAME }}/fastapi-app:latest
48+
${{ secrets.DOCKER_HUB_USERNAME }}/fastapi-app:${{ github.sha }}
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)