migrate to FastAPI #36
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
name: Test and Docker build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.x' | |
architecture: 'x64' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Test with pytest | |
run: | | |
pip install pytest pytest-cov | |
pytest | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build Docker images | |
run: | | |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/ai-chatbot-framework_backend . | |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/ai-chatbot-framework_frontend -f frontend/Dockerfile frontend/ | |
- name: Push Docker images | |
run: | | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/ai-chatbot-framework_backend:latest | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/ai-chatbot-framework_frontend:latest |