#974·openship

Folder-deploy context pruner silently drops directories from allowlist-style .dockerignore

Author: alexgrama-devCreated Sep 28, 2026Updated Sep 28, 2026

Summary

When deploying a folder (openship deploy --folder) whose repo uses an allowlist-style .dockerignore (deny-all + negations), the source-tree pruner deletes directories that the .dockerignore explicitly re-includes, so the Docker build fails with missing COPY sources.

Reproduction

  1. Repo with this .dockerignore:
*

!pyproject.toml
!src/
!src/**
!ops/
!ops/metabase/patch_accessibility.py
  1. Dockerfile with COPY src /app/haleon-src/src.
  2. openship deploy --folder --server <id>.

Observed: build context is missing src/ entirely; Docker reports:

COPY failed: file not found in build context or excluded by .dockerignore: stat src: file does not exist

Explicit-file re-includes (e.g. !ops/metabase/patch_accessibility.py) survive; directory re-includes do not.

Root cause

packages/adapters/src/runtime/docker-build-context.ts prunes the materialized tree with matcher.ignores(relativePath) (the npm ignore package) called on bare directory paths, then rm -rfs matches. Under gitignore semantics, the anchored /* matches the directory src, and the negation !src/ (dir-only form) does not re-match the bare path src:

ignore().add(['/*!src/','!src/**'].map(anchor)).ignores('src')  // true  -> pruned
ignore().add(['/*!src','!src/','!src/**'].map(anchor)).ignores('src')  // false -> kept

The source comment in prepareSourceTree already anticipates this ("an allowlist root .dockerignore (* + !src) would empty the tree"), but the destructive prune still runs for root-context folder deploys.

Workaround

Add bare re-includes alongside the dir forms in .dockerignore:

!src
!ops

Harmless for real Docker semantics; makes the pruner keep the directories.

Environment

  • openship CLI 1.x (npm), desktop-app control plane, macOS
  • Target server: Ubuntu WSL2, Docker 29 (legacy builder at the time)
  • Also observed: BuildKit (buildx) path consults credsStore for public base-image pulls and fails headless SSH sessions with error getting credentials - err: exit status 1, out: A specified logon session does not exist — a missing-credsStore config should fall back to anonymous pulls.