mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
- Add .gcloudignore to reduce upload from 43K files to 317 files (99% less) - Create Dockerfile.base with pre-built dependencies (~15 min, only when deps change) - Update Dockerfile to use base image (app builds now ~1-2 min) - Upgrade Cloud Build to N1_HIGHCPU_32 for faster compilation - Move Docker build from GitHub Actions to Cloud Build (faster GCP network) - Fix signed URL generation for Cloud Run (use IAM signBlob API) - Update submit-job.sh to poll for review completion instead of waiting for Enter - Sync Cloud Run deploy settings (16Gi RAM, 8 CPU, gen2, proper secrets)
42 lines
1.3 KiB
Docker
42 lines
1.3 KiB
Docker
# Base image with all Python dependencies pre-installed
|
|
# This image is rebuilt only when requirements.txt changes
|
|
#
|
|
# Build with: gcloud builds submit --config=cloudbuild-base.yaml
|
|
# Or manually: docker build -f backend/Dockerfile.base -t karaoke-backend-base .
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Install system dependencies required by karaoke-gen
|
|
RUN apt-get update && apt-get install -y \
|
|
ffmpeg \
|
|
libsndfile1 \
|
|
libsox-dev \
|
|
sox \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files
|
|
COPY pyproject.toml /app/
|
|
COPY README.md /app/
|
|
COPY LICENSE /app/
|
|
COPY backend/requirements.txt /app/backend/requirements.txt
|
|
|
|
# Install Python dependencies (the slow part - cached in base image)
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir -r backend/requirements.txt
|
|
|
|
# Copy and install karaoke_gen package (dependencies cached above)
|
|
COPY karaoke_gen /app/karaoke_gen
|
|
RUN pip install --no-cache-dir -e .
|
|
|
|
# Label with build info
|
|
ARG BUILD_DATE
|
|
ARG BUILD_ID
|
|
LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
|
LABEL org.opencontainers.image.revision="${BUILD_ID}"
|
|
LABEL org.opencontainers.image.title="karaoke-backend-base"
|
|
LABEL org.opencontainers.image.description="Base image with Python dependencies for karaoke-backend"
|