Skip to content

Fix docker configuration - rename dockerignore file#32

Merged
JesusSilvaUtrera merged 1 commit intomainfrom
fix/dockerignore
Oct 28, 2025
Merged

Fix docker configuration - rename dockerignore file#32
JesusSilvaUtrera merged 1 commit intomainfrom
fix/dockerignore

Conversation

@xaru8145
Copy link
Copy Markdown
Collaborator

@xaru8145 xaru8145 commented Oct 27, 2025

What this PR does

The current docker image contains the source code and the READMEs because the .dockerignore file was not being properly processed.

That is because unfortunately the docker ignore file needs to be in root of the build context directory and cannot live in subdirectories like docker/ in our case [Source].

A workaround to keep the file inside the docker folder, you can define a dockerignore file that has the same name as the docker file. From here:

The Docker client tries to load .dockerignore first and then falls back to .dockerignore if it can't be found. So docker build -f Dockerfile.foo . first tries to load Dockerfile.foo.dockerignore.

For our case, the elegant solution IMO is to rename .dockerignore to Dockerfile.dockerignore rather than moving .dockerignore one directory up so it is in the root of the build context.

Type

  • Bugfix
  • Feature
  • Documentation

How to test

Steps to reproduce / test the changes:

  1. Run the docker image without mounting the modules:
docker run -it --rm ros2-testing-workshop-roscon-es-25:jazzy bash
  1. Navigate to the modules inside the docker container and inspect whether package manifests are the only files found.

Checklist

  • I have signed my commits (git commit -s) or added Signed-off-by to existing commits.
  • I added/updated tests (if applicable)
  • I updated documentation (if applicable)

Related issues

@xaru8145
Copy link
Copy Markdown
Collaborator Author

Can you check this on your end and verify it works @JesusSilvaUtrera ?

Copy link
Copy Markdown
Collaborator

@JesusSilvaUtrera JesusSilvaUtrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I tested without mounting the vollumes and only the package.xml of the packages is present, not the source code.

@JesusSilvaUtrera JesusSilvaUtrera merged commit 6bfbf53 into main Oct 28, 2025
1 of 2 checks passed
@JesusSilvaUtrera JesusSilvaUtrera deleted the fix/dockerignore branch October 28, 2025 07:33
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.

2 participants