This file contains hidden or 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
name: Build and Deploy Image | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
Main: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository code |
This file contains hidden or 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
# GKE cluster | |
resource "google_container_cluster" "primary" { | |
name = "${var.project_id}-gke" | |
location = var.region | |
# We can't create a cluster with no node pool defined, but we want to only use | |
# separately managed node pools. So we create the smallest possible default | |
# node pool and immediately delete it. | |
remove_default_node_pool = true | |
initial_node_count = 1 |
This file contains hidden or 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
# VPC | |
resource "google_compute_network" "vpc" { | |
name = "${var.project_id}-vpc" | |
auto_create_subnetworks = "false" | |
} | |
# Subnet | |
resource "google_compute_subnetwork" "subnet" { | |
name = "${var.project_id}-subnet" | |
region = var.region |
This file contains hidden or 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
data "google_client_config" "primary" { | |
depends_on = [google_container_cluster.primary] | |
} | |
provider "kubernetes" { | |
host = "https://${google_container_cluster.primary.endpoint}" | |
token = data.google_client_config.primary.access_token | |
client_certificate = google_container_cluster.primary.master_auth.0.client_certificate | |
client_key = google_container_cluster.primary.master_auth.0.client_key | |
cluster_ca_certificate = base64decode( |
This file contains hidden or 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
FROM python:3.9.10-slim-bullseye | |
COPY requirements.txt requirements.txt | |
RUN pip3 install -r requirements.txt | |
COPY main.py . | |
EXPOSE 8000 | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0"] |
This file contains hidden or 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
import time | |
from fastapi import FastAPI | |
app: FastAPI = FastAPI() | |
@app.get("/version") | |
def get_version() -> str: | |
time.sleep(15) | |
return "v0.1" |
Disclaimer: I myself am not (yet) an engineering manager (EM). This is just for me to collect resources.
This file contains hidden or 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
val number = 7 | |
println(number.inv()) // will print -8 |
NewerOlder