dockerode-compose icon indicating copy to clipboard operation
dockerode-compose copied to clipboard

Enhance buildDockerImage error handling and include all context files

Open plarson opened this issue 11 months ago • 0 comments

This allows builds with an explicit Dockerfile to include files from the build context. The build process now includes all files in the specified build context directory. This is because Dockerode already respects the .dockerignore file, which means that while unnecessary files are filtered out, all relevant files must be present in the context for a successful build.

For example if you try to copy a script into the Docker image while using an explicit Dockerfile you would get this error: {"errorDetail":{"message":"COPY failed: file not found in build context or excluded by .dockerignore: stat config.sh: file does not exist"},"error":"COPY failed: file not found in build context or excluded by .dockerignore: stat config.sh: file does not exist"}

This also addresses issues related to error handling in the buildDockerImage function within the lib/servicesTools.js file. Previously, errors during the Docker image build process were failing silently, making it difficult to diagnose problems. This update enhances error detection and ensures that all relevant files in the build context directory are included in the build process.

plarson avatar Feb 06 '25 19:02 plarson