fix(deploy): fix render-worker build context + migration 040 idempotency
- docker-compose.yml: change render-worker build context from ./render-worker to . (project root) so pyproject.toml is accessible; update dockerfile path - render-worker/Dockerfile: update COPY paths for new build context; install Python 3.11 via deadsnakes PPA (Ubuntu 22.04 ships 3.10 which fails the >=3.11 requirement in pyproject.toml) - 040_media_assets.py: rewrite upgrade() with raw idempotent SQL (CREATE TYPE inside DO $$ EXCEPTION WHEN duplicate_object $$; CREATE TABLE IF NOT EXISTS; CREATE INDEX IF NOT EXISTS) to handle pre-existing enum from partial runs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,9 +11,17 @@ ENV PYOPENGL_PLATFORM=osmesa
|
||||
ENV VTK_DEFAULT_EGL=0
|
||||
|
||||
# Runtime libraries for cadquery/OCC + Blender 5.x headless
|
||||
# Also installs Python 3.11 via deadsnakes PPA (Ubuntu 22.04 ships 3.10)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
software-properties-common gnupg gpg-agent \
|
||||
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3.11 \
|
||||
python3.11-dev \
|
||||
python3.11-distutils \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
curl \
|
||||
libpq-dev \
|
||||
gcc \
|
||||
libxrender1 \
|
||||
@@ -40,21 +48,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Use Python 3.11 as the default pip target
|
||||
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
|
||||
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
|
||||
&& update-alternatives --install /usr/bin/pip3 pip3 /usr/local/bin/pip3.11 1
|
||||
|
||||
# Install backend Python dependencies (includes celery, sqlalchemy, fastapi, etc.)
|
||||
COPY pyproject.toml .
|
||||
COPY backend/pyproject.toml .
|
||||
RUN pip3 install --no-cache-dir -e .
|
||||
|
||||
# Install cadquery (heavy — installed after backend deps for better layer caching)
|
||||
RUN pip3 install --no-cache-dir "cadquery>=2.4.0"
|
||||
|
||||
# Copy render scripts
|
||||
COPY scripts/ /render-scripts/
|
||||
COPY render-worker/scripts/ /render-scripts/
|
||||
|
||||
# Version check script — fails fast if Blender < 5.0.1
|
||||
COPY check_version.py /check_version.py
|
||||
COPY render-worker/check_version.py /check_version.py
|
||||
|
||||
# Copy app code (overridden by volume mount in docker-compose)
|
||||
COPY . .
|
||||
# Copy backend app code (overridden by volume mount in docker-compose)
|
||||
COPY backend/ .
|
||||
|
||||
# Verify Blender version at build time if binary is available
|
||||
# (skipped during build since /opt/blender is a host mount)
|
||||
|
||||
Reference in New Issue
Block a user