diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..06dfe29 --- /dev/null +++ b/Dockerfile @@ -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}"] diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..1370dc2 --- /dev/null +++ b/cloudbuild.yaml @@ -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'