fix: use trailing slash on multi-source COPY destinations#48
Open
MatthewJamisonJS wants to merge 1 commit intoref-tools:mainfrom
Open
fix: use trailing slash on multi-source COPY destinations#48MatthewJamisonJS wants to merge 1 commit intoref-tools:mainfrom
MatthewJamisonJS wants to merge 1 commit intoref-tools:mainfrom
Conversation
Modern Docker builders (BuildKit, default since Docker 23) reject
multi-source COPY instructions whose destination does not end with a
slash, per the Dockerfile reference: "If multiple <src> resources are
specified ... then <dest> must be a directory, and it must end with a
slash /."
Building this image with default Docker fails at:
Step 3/14 : COPY package.json package-lock.json tsconfig.json .
When using COPY with more than one source file, the destination
must be a directory and end with a /
Fix the two affected lines (lines 8 and 18) by changing the
destination from "." to "./". Single-source COPY instructions are
unchanged because Docker resolves them against the WORKDIR directly.
Build verified locally with Docker 28.5.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker buildfails on current Docker (BuildKit, default since Docker 23) because twoCOPYlines use.as the destination with multiple sources:The Dockerfile reference requires a trailing
/for multi-source copies. Changing.→./on the two affected lines fixes the build.Single-source
COPYlines are untouched.Verified locally on Docker 28.5.1 — build completes and
docker run -e REF_API_KEY=test ...starts as expected. Independent of #47 (different lines); built both layered together too with no conflict.