I've encountered an inconsistency with
I've encountered an inconsistency with how wrangler dev and wrangler deploy handle Docker build contexts.
The Issue:
When I place my Dockerfile in a subdirectory (e.g., cf-worker/containers/project-a/Dockerfile) and set the image field in wrangler.jsonc to './containers/project-a/Dockerfile':
wrangler dev builds successfully
wrangler deploy fails
Root Cause:
The two commands use different build contexts:
wrangler dev uses the Dockerfile's directory as the build context
wrangler deploy uses the worker's root directory as the build context
Current Workaround:
To make both commands work, I have to:
Move the Dockerfile to the worker root
Update the image field in wrangler.jsonc to './Dockerfile'
Modify COPY statements in the Dockerfile to account for the new context
Also deployed container has 30 second cold start and causing transaction timeout errors ðŸ˜
2 Replies
hey really sorry about this, there is a bug in wrangler deploy around this that we're working to address. does setting
image_build_context
in your wrangler config fix this? we should be correctly respecting that valueSetting the image_build_context fixed it thank you.