Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PORT=8080
WORKDIR /app
COPY requirements*.txt ./
RUN pip install --no-cache-dir -r requirements.txt
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}"]
24 changes: 24 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by deployment-agent. Reused across dev/prod via substitutions.
steps:
- 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}',
'${_AUTH}', '--ingress=${_INGRESS}', '--quiet']
images:
- '${_IMAGE}'
substitutions:
_SERVICE_NAME: 'app'
_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'
timeout: '1200s'