Skip to content

Fixed the docker hub repo name #10

Fixed the docker hub repo name

Fixed the docker hub repo name #10

Workflow file for this run

name: Build and Deploy Code
on: [push, pull_request]
jobs:
job1:
environment:
name: testing
env:
PG_USERNAME: ${{secrets.PG_USERNAME}}
PG_PASSWORD: ${{secrets.PG_PASSWORD}}
PG_HOST: ${{secrets.PG_HOST}}
PG_PORT: ${{secrets.PG_PORT}}
PG_DATABASE: ${{secrets.PG_DATABASE}}
SECRET_KEY: ${{secrets.SECRET_KEY}}
ALGORITHM: ${{secrets.ALGORITHM}}
ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: ${{secrets.PG_PASSWORD}}
POSTGRES_DB: ${{secrets.PG_DATABASE}}_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
runs-on: ubuntu-latest
steps:
- name: Pull the git repository
uses: actions/checkout@v4
- name: Install python version 3.11.6
uses: actions/setup-python@v4
with:
python-version: '3.11.6'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests with Pytest
run: |
pip install pytest
pytest -v -s --disable-warnings
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sm-fastapi:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max