moby / moby/moby

Support shared content during build

Open
#48,739 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
72.1k
Forks
19.2k
Avg merge
1d 17h
Merged PRs (30d)
164

Description

Description

It would be helpful to have a Docker-managed means to share files across build instead in a way that allows for temporary containers to do some up-front work to better support monorepo structures, similar to how volumes are for content used at runtime.

Example: Say you have a monorepo with two packages, client and server. At the repo root you define your workspaces and when you run an install node_modules and the lockfile are only generated at the repo root and dependencies are deduplicated in both resulting in performance improvements.

Ideally you'd like to have a docker compose setup with these steps

  1. Run install with a frozen lockfile for security in a temporary container
  2. Save off the generated node_modules content
  3. Allow your temporary container to exit
  4. Start your depends_on with condition service_completed_successfully services that need those node_modules and reference that saved off content

Since your first image needs to complete and exit, you cannot use COPY --from=build-stage because that container is already stopped, so there's no good way to share those files with subsequent image build, unless you use a bind mount. If we had something fully managed by Docker during build (like how volumes are for runtime sharing across images) which was guaranteed to be temporary and not need to interact with the local filesystem directly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests. Start by examining the existing Docker build behavior around COPY --from and bind mounts, then compare it with Docker Compose's service_completed_successfully flow. Done would require a defined temporary, Docker-managed mechanism for sharing generated build content across these stages.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, node.js
Domain
build-system, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.