Skip to content

Commit

Permalink
UPDATE
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzasaverio committed Feb 6, 2024
1 parent 31cada8 commit d41df7d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
19 changes: 16 additions & 3 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ resource "google_project_iam_member" "cloud_build_service_account_iam_roles" {
}




/* -------------------------------------------------------------------------- */
/* Modules */
/* -------------------------------------------------------------------------- */

module "secret_manager" {
source = "./modules/secret_manager"
Expand All @@ -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
Expand All @@ -77,7 +90,7 @@ module "cloud_build" {
github_remote_uri = var.github_remote_uri

depends_on = [

module.cloud_run,
module.secret_manager
]
}

0 comments on commit d41df7d

Please sign in to comment.