Files
karaoke-gen/cloudbuild-base.yaml
T
Andrew Beveridge 6dc3962797 Simplify CI/Docker: use poetry and Python 3.13 everywhere
- Update CI to use poetry instead of pip with frozen requirements
- Upgrade CI from Python 3.12 to 3.13 (matches pyproject.toml and dev env)
- Simplify Dockerfile.base to use pip install -e . directly
- Remove requirements-frozen.txt (caused Python version mismatches)
- Update documentation to reflect simpler setup
2025-12-10 13:40:55 -05:00

57 lines
1.9 KiB
YAML

# Cloud Build configuration for base image
#
# This builds the base image with all Python dependencies pre-installed.
# Run this manually when poetry.lock changes:
# gcloud builds submit --config=cloudbuild-base.yaml --project=nomadkaraoke
#
# The base image is used by the main Dockerfile for fast app builds.
# The poetry.lock hash is stored as a label for change detection.
steps:
# Calculate poetry.lock hash for change detection
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
POETRY_LOCK_HASH=$$(sha256sum poetry.lock | cut -d' ' -f1)
echo "Poetry.lock hash: $$POETRY_LOCK_HASH"
echo "$$POETRY_LOCK_HASH" > /workspace/POETRY_LOCK_HASH
# Build base image with all dependencies
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
POETRY_LOCK_HASH=$$(cat /workspace/POETRY_LOCK_HASH)
docker build \
--build-arg BUILD_DATE=$BUILD_ID \
--build-arg BUILD_ID=$BUILD_ID \
--build-arg POETRY_LOCK_HASH=$$POETRY_LOCK_HASH \
-t us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:latest \
-t us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:$BUILD_ID \
-f backend/Dockerfile.base \
.
# Push base image
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:latest'
- name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:$BUILD_ID'
images:
- 'us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:latest'
- 'us-central1-docker.pkg.dev/$PROJECT_ID/karaoke-repo/karaoke-backend-base:$BUILD_ID'
options:
machineType: 'N1_HIGHCPU_32'
diskSizeGb: 100
timeout: 1800s