diff --git a/Dockerfile b/Dockerfile index 31456b7..f4c0c99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,15 @@ -FROM python:3.9-slim +# Use an official Python runtime with NVIDIA CUDA support +FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 WORKDIR /app +# Copy your application files COPY . /app -RUN pip install --no-cache-dir -r requirements.txt +# Install Python and FastAPI dependencies +RUN apt-get update && apt-get install -y python3-pip && \ + pip3 install --no-cache-dir -r requirements.txt -CMD uvicorn main:app --port=8000 --host=0.0.0.0 +EXPOSE 8000 +CMD uvicorn main:app --port=${PORT:-8000} --host=0.0.0.0 diff --git a/README.md b/README.md index bf9ad47..cd7eb32 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ FastAPI is used to handle pub/sub requests. For setting up infrastructure compon The main functionalities – database connectivity with read/write operations and text translation using a pre-trained model fetched from Hugging Face – are all triggered in the cloud when a message from pub/sub arrives. However, for local testing and independent execution, these functions can be run directly from the terminal. -## Local Testing of /pubsub-handler +## Local Testing To test the `/pubsub-handler` endpoint locally: diff --git a/terraform/main.tf b/terraform/main.tf index 63f38e4..7f8fef3 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -56,8 +56,9 @@ resource "google_project_iam_member" "cloud_build_service_account_iam_roles" { } - - +/* -------------------------------------------------------------------------- */ +/* Modules */ +/* -------------------------------------------------------------------------- */ module "secret_manager" { source = "./modules/secret_manager" @@ -66,6 +67,18 @@ module "secret_manager" { +module "cloud_run" { + source = "./modules/cloud_run" + + gcp_project_id = var.gcp_project_id + gcp_region = var.gcp_region + network_id = var.gcp_network_name + depends_on = [ + module.secret_manager + ] +} + + module "cloud_build" { source = "./modules/cloud_build" gcp_project_id = var.gcp_project_id @@ -77,7 +90,7 @@ module "cloud_build" { github_remote_uri = var.github_remote_uri depends_on = [ - + module.cloud_run, module.secret_manager ] }