Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Docker buildx fails to resolve the build context when copying directories without explicit ./ prefix in multi-stage builds, resulting in "/README.md": not found errors.

Changes

  • Dockerfile: Changed COPY checkdmarc/ checkdmarc/ to COPY checkdmarc/ ./checkdmarc/ to explicitly specify the destination path relative to WORKDIR

The explicit ./ prefix ensures Docker buildx correctly resolves file paths in the build context during multi-stage builds.

Original prompt

This section details on the original issue you should resolve

<issue_title>Docker & build</issue_title>
<issue_description>using your Dockerfile :

docker buildx build --file Dockerfile --tag check_dmarc .

[+] Building 1.2s (9/12) docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 629B 0.0s
=> [internal] load metadata for docker.io/library/python:3.13-slim 1.2s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [build 1/6] FROM docker.io/library/python:3.13-slim@sha256:baf66684c5fcafbda38a54b227ee30ec41e40af1e4073edee3a7110a417756ba 0.0s
=> => resolve docker.io/library/python:3.13-slim@sha256:baf66684c5fcafbda38a54b227ee30ec41e40af1e4073edee3a7110a417756ba 0.0s
=> => sha256:baf66684c5fcafbda38a54b227ee30ec41e40af1e4073edee3a7110a417756ba 10.37kB / 10.37kB 0.0s
=> => sha256:6ea5d7c9376f1f4fcb9a41b4250f8c2667865d86aae925adfba67f832ed0584c 1.75kB / 1.75kB 0.0s
=> => sha256:22feee3156404e79c24866d7d022bbba8542c08365666092f71a0deed6886c09 5.53kB / 5.53kB 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [build 2/6] WORKDIR /app 0.0s
=> CACHED [build 3/6] RUN pip install hatch 0.0s
=> ERROR [build 4/6] COPY checkdmarc/ checkdmarc/ 0.0s
=> ERROR [build 5/6] COPY README.md pyproject.toml ./ 0.0s

[build 4/6] COPY checkdmarc/ checkdmarc/:
[build 5/6] COPY README.md pyproject.toml ./:

Dockerfile:15

13 |
14 | COPY checkdmarc/ checkdmarc/
15 | >>> COPY README.md pyproject.toml ./
16 |
17 | RUN hatch build

ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref dec753e6-0d6d-4cd1-82fb-e0fdb6f72ec7::0p0kcne1uuyy6nfc6zmvchwyz: "/README.md": not found
</issue_description>

<agent_instructions>Fix the Dockerfile to resolve the error</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: seanthegeek <44679+seanthegeek@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Docker build process in Dockerfile Fix Dockerfile COPY destination path for buildx compatibility Dec 29, 2025
Copilot AI requested a review from seanthegeek December 29, 2025 17:23
@seanthegeek seanthegeek marked this pull request as ready for review December 29, 2025 17:25
@seanthegeek seanthegeek merged commit 3703b06 into main Dec 29, 2025
1 check passed
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.

Docker & build

2 participants