diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 0000000..0cb204f --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,37 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push (linux/amd64) + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + platforms: linux/amd64 + tags: | + architanant/stroxapi:latest + architanant/stroxapi:${{ github.sha }} diff --git a/main.py b/main.py index 3a0a53d..0749084 100644 --- a/main.py +++ b/main.py @@ -54,6 +54,11 @@ async def lifespan(app: FastAPI): app = FastAPI(title="Strox Handwriting Generation API", lifespan=lifespan) +# health check endpoint +@app.get("/health/") +async def health_check(): + return {"status": "ok"} + @app.post("/generate/") async def generate_handwriting(payload: HandwritingRequest):