Skip to content

fix: use trailing slash on multi-source COPY destinations#48

Open
MatthewJamisonJS wants to merge 1 commit intoref-tools:mainfrom
MatthewJamisonJS:fix/dockerfile-copy-multi-source-syntax
Open

fix: use trailing slash on multi-source COPY destinations#48
MatthewJamisonJS wants to merge 1 commit intoref-tools:mainfrom
MatthewJamisonJS:fix/dockerfile-copy-multi-source-syntax

Conversation

@MatthewJamisonJS
Copy link
Copy Markdown

@MatthewJamisonJS MatthewJamisonJS commented May 6, 2026

docker build fails on current Docker (BuildKit, default since Docker 23) because two COPY lines use . as the destination with multiple sources:

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 /

The Dockerfile reference requires a trailing / for multi-source copies. Changing ../ on the two affected lines fixes the build.

-COPY package.json package-lock.json tsconfig.json .
+COPY package.json package-lock.json tsconfig.json ./

-COPY package.json package-lock.json .
+COPY package.json package-lock.json ./

Single-source COPY lines 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant