From 514db4905f6ff656394a60ec991a2c1883cfbf57 Mon Sep 17 00:00:00 2001 From: wisdom-is-chasing-u-and-u-are-faster Date: Wed, 24 Jun 2026 13:37:54 +0530 Subject: [PATCH 1/5] chore(cicd): add deployment pipeline files [deployment-agent] --- Dockerfile | 6 ++++++ cloudbuild.yaml | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Dockerfile create mode 100644 cloudbuild.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b14a18e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.9-slim +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +COPY ./app /app +CMD uvicorn main:app --host 0.0.0.0 --port ${PORT:-8080} \ No newline at end of file diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..f6603be --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,20 @@ +steps: +- name: 'gcr.io/cloud-builders/docker' + args: ['build', '-t', 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA', '.'] +- name: 'gcr.io/cloud-builders/docker' + args: ['push', 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA'] +- name: 'gcr.io/google-cloud-sdk' + entrypoint: gcloud + args: + - 'run' + - 'deploy' + - 'fastapi-sqlite-dev' + - '--image' + - 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA' + - '--region' + - 'us-central1' + - '--platform' + - 'managed' + - '--allow-unauthenticated' +images: +- 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA' \ No newline at end of file From d678e02f47296b09a9ffad3e2fd22ab086026665 Mon Sep 17 00:00:00 2001 From: wisdom-is-chasing-u-and-u-are-faster Date: Wed, 24 Jun 2026 17:44:17 +0530 Subject: [PATCH 2/5] chore(cicd): add deployment pipeline files [deployment-agent] --- cloudbuild.yaml | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index f6603be..13259ea 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,20 +1,22 @@ +# Generated by deployment-agent. Reused across dev/prod via substitutions. steps: -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA', '.'] -- name: 'gcr.io/cloud-builders/docker' - args: ['push', 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA'] -- name: 'gcr.io/google-cloud-sdk' - entrypoint: gcloud - args: - - 'run' - - 'deploy' - - 'fastapi-sqlite-dev' - - '--image' - - 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA' - - '--region' - - 'us-central1' - - '--platform' - - 'managed' - - '--allow-unauthenticated' + - name: 'gcr.io/cloud-builders/docker' + args: ['build', '-t', '${_IMAGE}', '.'] + - name: 'gcr.io/cloud-builders/docker' + args: ['push', '${_IMAGE}'] + - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' + entrypoint: gcloud + args: ['run', 'deploy', '${_SERVICE_NAME}', '--image=${_IMAGE}', + '--region=${_REGION}', '--platform=managed', '--port=${_PORT}', + '--allow-unauthenticated', '--quiet'] images: -- 'gcr.io/$PROJECT_ID/fastapi-sqlite-dev:$COMMIT_SHA' \ No newline at end of file + - '${_IMAGE}' +substitutions: + _SERVICE_NAME: 'app' + _REGION: 'us-central1' + _IMAGE: 'gcr.io/PROJECT_ID/app:latest' + _PORT: '8080' +options: + logging: CLOUD_LOGGING_ONLY + substitution_option: 'ALLOW_LOOSE' +timeout: 1200s From ce7ac5b8b74dcfa66f6396265cb9b1f05899e6a8 Mon Sep 17 00:00:00 2001 From: wisdom-is-chasing-u-and-u-are-faster Date: Wed, 24 Jun 2026 20:15:18 +0530 Subject: [PATCH 3/5] chore(cicd): add deployment pipeline files [deployment-agent] --- cloudbuild.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 13259ea..8b11af4 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -8,7 +8,7 @@ steps: entrypoint: gcloud args: ['run', 'deploy', '${_SERVICE_NAME}', '--image=${_IMAGE}', '--region=${_REGION}', '--platform=managed', '--port=${_PORT}', - '--allow-unauthenticated', '--quiet'] + '${_AUTH}', '--ingress=${_INGRESS}', '--quiet'] images: - '${_IMAGE}' substitutions: @@ -16,6 +16,8 @@ substitutions: _REGION: 'us-central1' _IMAGE: 'gcr.io/PROJECT_ID/app:latest' _PORT: '8080' + _AUTH: '--allow-unauthenticated' + _INGRESS: 'all' options: logging: CLOUD_LOGGING_ONLY substitution_option: 'ALLOW_LOOSE' From 1689b24d580f73f5633e5d7896f257548aef13bd Mon Sep 17 00:00:00 2001 From: wisdom-is-chasing-u-and-u-are-faster Date: Wed, 24 Jun 2026 21:41:13 +0530 Subject: [PATCH 4/5] chore(cicd): add deployment pipeline files [deployment-agent] From 3827ee300d9f8f3741c88812abd66132c8cd0823 Mon Sep 17 00:00:00 2001 From: wisdom-is-chasing-u-and-u-are-faster Date: Wed, 24 Jun 2026 21:51:41 +0530 Subject: [PATCH 5/5] chore(cicd): add deployment pipeline files [deployment-agent] --- Dockerfile | 11 +++++++---- cloudbuild.yaml | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index b14a18e..06dfe29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ -FROM python:3.9-slim +FROM python:3.11-slim +ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PORT=8080 WORKDIR /app -COPY requirements.txt . +COPY requirements*.txt ./ RUN pip install --no-cache-dir -r requirements.txt -COPY ./app /app -CMD uvicorn main:app --host 0.0.0.0 --port ${PORT:-8080} \ No newline at end of file +RUN pip install --no-cache-dir gunicorn uvicorn +COPY . . +EXPOSE 8080 +CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-8080}"] diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 8b11af4..1370dc2 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -5,7 +5,7 @@ steps: - name: 'gcr.io/cloud-builders/docker' args: ['push', '${_IMAGE}'] - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' - entrypoint: gcloud + entrypoint: 'gcloud' args: ['run', 'deploy', '${_SERVICE_NAME}', '--image=${_IMAGE}', '--region=${_REGION}', '--platform=managed', '--port=${_PORT}', '${_AUTH}', '--ingress=${_INGRESS}', '--quiet'] @@ -19,6 +19,6 @@ substitutions: _AUTH: '--allow-unauthenticated' _INGRESS: 'all' options: - logging: CLOUD_LOGGING_ONLY + logging: 'CLOUD_LOGGING_ONLY' substitution_option: 'ALLOW_LOOSE' -timeout: 1200s +timeout: '1200s'