Added git commit id to build process
This commit is contained in:
1 parent
b0f995d906
commit
64d9a5e715
5 files changed
+15
-5
No files matched your search
@@ -35,7 +35,9 @@ jobs:
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }} .
|
||||
docker build \
|
||||
--build-arg COMMIT_ID=$(echo "${{ github.sha }}" | cut -c1-7) \
|
||||
-t ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }} .
|
||||
docker push ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }}
|
||||
|
||||
- name: Clone ops-deployment repo
|
||||
|
||||
@@ -35,7 +35,9 @@ jobs:
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }} .
|
||||
docker build \
|
||||
--build-arg COMMIT_ID=$(echo "${{ github.sha }}" | cut -c1-7) \
|
||||
-t ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }} .
|
||||
docker push ghcr.io/gansejunge/${{ env.IMAGE_NAME }}:${{ steps.get_tag.outputs.next }}
|
||||
|
||||
- name: Clone ops-deployment repo
|
||||
|
||||
@@ -11,4 +11,8 @@ FROM nvcr.io/nvidia/distroless/python:3.12-v4.1.6
|
||||
COPY --from=builder /install /usr/local
|
||||
COPY --from=builder /app /app
|
||||
WORKDIR /app
|
||||
|
||||
ARG COMMIT_ID=unknown
|
||||
ENV COMMIT_ID=$COMMIT_ID
|
||||
|
||||
ENTRYPOINT ["python", "main.py"]
|
||||
+1
-1
@@ -13,7 +13,7 @@ ignore = ["E501"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
known-first-party = ["db_module", "metrics_server", "rabbitmq_handler", "secret_manager",
|
||||
"simple_logger_handler", "uvicorn_logger_config", "validator"]
|
||||
"simple_logger_handler", "send_notifications"]
|
||||
|
||||
[tool.ruff.format]
|
||||
indent-style = "tab"
|
||||
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
from datetime import UTC, datetime
|
||||
|
||||
@@ -6,7 +7,6 @@ import uvicorn
|
||||
from fastapi import Depends, FastAPI, HTTPException, Request
|
||||
from pydantic import BaseModel, Field
|
||||
from seadex import EntryNotFoundError, SeaDexEntry
|
||||
from send_notifications import NotificationClient
|
||||
|
||||
from anilist_query import AniListError, AnimeNotFoundError, MissingAnimeName, get_anime_name
|
||||
from db_module import (
|
||||
@@ -17,6 +17,7 @@ from db_module import (
|
||||
)
|
||||
from metrics_server import REQUEST_COUNTER, metrics_api
|
||||
from secret_manager import cleanup_secret_files
|
||||
from send_notifications import NotificationClient
|
||||
from simple_logger_handler import LOG_LEVEL, setup_logger
|
||||
|
||||
logger = setup_logger(__name__)
|
||||
@@ -163,7 +164,7 @@ def add_anime(anime: AnimeCreate, db=Depends(get_db)):
|
||||
)
|
||||
|
||||
if cursor.fetchone():
|
||||
logger.debug(f"[FastAPI] Found existing entry, updating name and setting to active")
|
||||
logger.debug("[FastAPI] Found existing entry, updating name and setting to active")
|
||||
cursor.execute(
|
||||
"UPDATE seadex_state SET anime_name = %s, active = 1 "
|
||||
"WHERE anilist_id = %s",
|
||||
@@ -236,6 +237,7 @@ def remove_anime(anime: AnimeCreate, db=Depends(get_db)):
|
||||
|
||||
async def start_servers():
|
||||
logger.info("[Server] Starting main API (port 5000) and metrics server (port 9000)...")
|
||||
logger.info(f"[Server] Build commit id={os.getenv("COMMIT_ID","unknown")}")
|
||||
config_main = uvicorn.Config(api, host="0.0.0.0", port=5000, log_level=LOG_LEVEL.lower(),log_config=None)
|
||||
config_metrics = uvicorn.Config(metrics_api, host="0.0.0.0", port=9000, log_level=LOG_LEVEL.lower(),log_config=None)
|
||||
|
||||
|
||||
Reference in new issue
Block a user