Skip to content

bug: docker/backend/Dockerfile missing COPY for src/backend/canary/ package #768

Closed

Description

@vybe

Summary

The backend Docker image build succeeds but the container crashes immediately on startup with ModuleNotFoundError: No module named 'canary'. The new src/backend/canary/ Python package was introduced but docker/backend/Dockerfile was not updated with a corresponding COPY instruction. This prevents trinity-backend from starting entirely.

Component

Backend / Docker Build

Priority

P1

Error

ModuleNotFoundError: No module named 'canary'
  File "/app/routers/canary.py", line 21, in <module>
    from canary import INVARIANTS

Location

  • File: docker/backend/Dockerfile
  • Line: COPY block (after existing COPY ../../src/backend/routers /app/routers/)
  • Function/Class: N/A — build-time omission

Root Cause

The Dockerfile uses explicit per-directory COPY instructions rather than a wildcard COPY. When src/backend/canary/ was added as a new package, the Dockerfile was not updated to copy it into the image.

The build copies src/backend/routers/ (which now includes routers/canary.py), but does not copy the canary/ package itself — so the import at line 21 of routers/canary.py fails at container startup:

# Dockerfile currently has:
COPY ../../src/backend/routers /app/routers/   # copies routers/canary.py ✓
# COPY ../../src/backend/canary /app/canary/   # ← MISSING — package not in image

Reproduction Steps

  1. Pull any commit from the batch that introduced src/backend/canary/ (e.g. commits merged around 2026-05-10)
  2. Rebuild backend image: docker compose -f docker-compose.prod.yml build backend
  3. Start the container: docker compose -f docker-compose.prod.yml up -d backend
  4. Check logs: docker logs trinity-backend --tail 30
  5. Observe ModuleNotFoundError: No module named 'canary' — container exits unhealthy

Suggested Fix

Add a COPY instruction for the new canary/ package in docker/backend/Dockerfile, alongside the existing backend source copies:

COPY ../../src/backend/routers /app/routers/
COPY ../../src/backend/services /app/services/
COPY ../../src/backend/adapters /app/adapters/
COPY ../../src/backend/utils /app/utils/
COPY ../../src/backend/db /app/db/
COPY ../../src/backend/canary /app/canary/   # ← ADD THIS

Environment

  • Trinity version: commit 9a57c6e2 (first commit in batch introducing src/backend/canary/)
  • Affected file: docker/backend/Dockerfile
  • OS: Ubuntu 22.04

Related

  • New package introduced: src/backend/canary/
  • Router added: src/backend/routers/canary.py (imports from canary)
  • Backend entrypoint updated: src/backend/main.py (imports canary router + service)
  • Dockerfile: docker/backend/Dockerfile

Activity

  1. added
    status-in-dev
    and removed on May 11, 2026
  2. vybe commented on Jun 1, 2026

    @vybe
    ContributorAuthor

    Shipped in v0.6.0 (released via #998).

  3. removed
    status-in-dev
    on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-p1type-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions