-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tryolabs/feature/part3
Feature/part3
- Loading branch information
Showing
10 changed files
with
458 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
FROM python:latest | ||
# put you docker configuration here | ||
FROM python:3.9-slim | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install build dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y build-essential gcc libssl-dev | ||
|
||
# Copy requirements files for the container | ||
COPY requirements*.txt ./ | ||
|
||
# Install Python dependencies | ||
RUN pip install -r requirements.txt -r requirements-dev.txt | ||
|
||
# Copy the entire project into the container | ||
COPY . . | ||
|
||
# Expose port | ||
EXPOSE 8000 | ||
|
||
# Run the application inside the container | ||
CMD ["uvicorn", "challenge.api:app", "--host", "0.0.0.0", "--port", "8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
provider "google" { | ||
project = var.project_id | ||
region = var.region | ||
} | ||
|
||
resource "google_cloud_run_service" "latam_challenge_service" { | ||
name = "latam-challenge" | ||
location = var.region | ||
|
||
template { | ||
spec { | ||
containers { | ||
image = var.image_url | ||
|
||
ports { | ||
container_port = 8000 | ||
} | ||
} | ||
} | ||
} | ||
|
||
traffic { | ||
percent = 100 | ||
latest_revision = true | ||
} | ||
} | ||
|
||
resource "google_cloud_run_service_iam_policy" "noauth" { | ||
location = google_cloud_run_service.latam_challenge_service.location | ||
project = google_cloud_run_service.latam_challenge_service.project | ||
service = google_cloud_run_service.latam_challenge_service.name | ||
|
||
policy_data = data.google_iam_policy.noauth.policy_data | ||
} | ||
|
||
data "google_iam_policy" "noauth" { | ||
binding { | ||
role = "roles/run.invoker" | ||
|
||
members = [ | ||
"allUsers", | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "service_url" { | ||
description = "The URL of the deployed Cloud Run service" | ||
value = google_cloud_run_service.latam_challenge_service.status[0].url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
{ | ||
"version": 4, | ||
"terraform_version": "1.5.2", | ||
"serial": 11, | ||
"lineage": "41caa1a9-fd55-f2c3-6cf1-50daff5a262d", | ||
"outputs": { | ||
"service_url": { | ||
"value": "https://latam-challenge-7eedzyco2q-uc.a.run.app", | ||
"type": "string" | ||
} | ||
}, | ||
"resources": [ | ||
{ | ||
"mode": "data", | ||
"type": "google_iam_policy", | ||
"name": "noauth", | ||
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]", | ||
"instances": [ | ||
{ | ||
"schema_version": 0, | ||
"attributes": { | ||
"audit_config": null, | ||
"binding": [ | ||
{ | ||
"condition": [], | ||
"members": [ | ||
"allUsers" | ||
], | ||
"role": "roles/run.invoker" | ||
} | ||
], | ||
"id": "3450855414", | ||
"policy_data": "{\"bindings\":[{\"members\":[\"allUsers\"],\"role\":\"roles/run.invoker\"}]}" | ||
}, | ||
"sensitive_attributes": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"mode": "managed", | ||
"type": "google_cloud_run_service", | ||
"name": "latam_challenge_service", | ||
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]", | ||
"instances": [ | ||
{ | ||
"schema_version": 2, | ||
"attributes": { | ||
"autogenerate_revision_name": false, | ||
"id": "locations/us-central1/namespaces/florencia-tryolabs-latam/services/latam-challenge", | ||
"location": "us-central1", | ||
"metadata": [ | ||
{ | ||
"annotations": {}, | ||
"effective_annotations": { | ||
"run.googleapis.com/ingress": "all", | ||
"run.googleapis.com/ingress-status": "all", | ||
"run.googleapis.com/operation-id": "798e9ce8-f9a8-4c27-a595-6ab85ec73a63", | ||
"serving.knative.dev/creator": "florencia@tryolabs.com", | ||
"serving.knative.dev/lastModifier": "florencia@tryolabs.com" | ||
}, | ||
"effective_labels": { | ||
"cloud.googleapis.com/location": "us-central1" | ||
}, | ||
"generation": 1, | ||
"labels": {}, | ||
"namespace": "florencia-tryolabs-latam", | ||
"resource_version": "AAYbzoRf3lE", | ||
"self_link": "/apis/serving.knative.dev/v1/namespaces/307648342667/services/latam-challenge", | ||
"terraform_labels": {}, | ||
"uid": "22637102-e0fa-49ea-8643-85dfc7604be4" | ||
} | ||
], | ||
"name": "latam-challenge", | ||
"project": "florencia-tryolabs-latam", | ||
"status": [ | ||
{ | ||
"conditions": [ | ||
{ | ||
"message": "", | ||
"reason": "", | ||
"status": "True", | ||
"type": "Ready" | ||
}, | ||
{ | ||
"message": "", | ||
"reason": "", | ||
"status": "True", | ||
"type": "ConfigurationsReady" | ||
}, | ||
{ | ||
"message": "", | ||
"reason": "", | ||
"status": "True", | ||
"type": "RoutesReady" | ||
} | ||
], | ||
"latest_created_revision_name": "latam-challenge-00001-xqz", | ||
"latest_ready_revision_name": "latam-challenge-00001-xqz", | ||
"observed_generation": 1, | ||
"traffic": [ | ||
{ | ||
"latest_revision": true, | ||
"percent": 100, | ||
"revision_name": "latam-challenge-00001-xqz", | ||
"tag": "", | ||
"url": "" | ||
} | ||
], | ||
"url": "https://latam-challenge-7eedzyco2q-uc.a.run.app" | ||
} | ||
], | ||
"template": [ | ||
{ | ||
"metadata": [ | ||
{ | ||
"annotations": { | ||
"autoscaling.knative.dev/maxScale": "100" | ||
}, | ||
"generation": 0, | ||
"labels": { | ||
"run.googleapis.com/startupProbeType": "Default" | ||
}, | ||
"name": "", | ||
"namespace": "", | ||
"resource_version": "", | ||
"self_link": "", | ||
"uid": "" | ||
} | ||
], | ||
"spec": [ | ||
{ | ||
"container_concurrency": 80, | ||
"containers": [ | ||
{ | ||
"args": null, | ||
"command": null, | ||
"env": [], | ||
"env_from": [], | ||
"image": "us-docker.pkg.dev/florencia-tryolabs-latam/florencia-repo-latam-challenge/latam-challenge", | ||
"liveness_probe": [], | ||
"name": "", | ||
"ports": [ | ||
{ | ||
"container_port": 8000, | ||
"name": "http1", | ||
"protocol": "" | ||
} | ||
], | ||
"resources": [ | ||
{ | ||
"limits": { | ||
"cpu": "1000m", | ||
"memory": "512Mi" | ||
}, | ||
"requests": {} | ||
} | ||
], | ||
"startup_probe": [ | ||
{ | ||
"failure_threshold": 1, | ||
"grpc": [], | ||
"http_get": [], | ||
"initial_delay_seconds": 0, | ||
"period_seconds": 240, | ||
"tcp_socket": [ | ||
{ | ||
"port": 8000 | ||
} | ||
], | ||
"timeout_seconds": 240 | ||
} | ||
], | ||
"volume_mounts": [], | ||
"working_dir": "" | ||
} | ||
], | ||
"service_account_name": "307648342667-compute@developer.gserviceaccount.com", | ||
"serving_state": "", | ||
"timeout_seconds": 300, | ||
"volumes": [] | ||
} | ||
] | ||
} | ||
], | ||
"timeouts": null, | ||
"traffic": [ | ||
{ | ||
"latest_revision": true, | ||
"percent": 100, | ||
"revision_name": "", | ||
"tag": "", | ||
"url": "" | ||
} | ||
] | ||
}, | ||
"sensitive_attributes": [], | ||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMiJ9" | ||
} | ||
] | ||
}, | ||
{ | ||
"mode": "managed", | ||
"type": "google_cloud_run_service_iam_policy", | ||
"name": "noauth", | ||
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]", | ||
"instances": [ | ||
{ | ||
"schema_version": 0, | ||
"attributes": { | ||
"etag": "BwYbzoS1QOI=", | ||
"id": "v1/projects/florencia-tryolabs-latam/locations/us-central1/services/latam-challenge", | ||
"location": "us-central1", | ||
"policy_data": "{\"bindings\":[{\"members\":[\"allUsers\"],\"role\":\"roles/run.invoker\"}]}", | ||
"project": "florencia-tryolabs-latam", | ||
"service": "v1/projects/florencia-tryolabs-latam/locations/us-central1/services/latam-challenge" | ||
}, | ||
"sensitive_attributes": [], | ||
"private": "bnVsbA==", | ||
"dependencies": [ | ||
"data.google_iam_policy.noauth", | ||
"google_cloud_run_service.latam_challenge_service" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"check_results": null | ||
} |
Oops, something went wrong.