Skip to content

Conversation

rubys
Copy link
Contributor

@rubys rubys commented Jul 8, 2025

Summary

  • Fix issue where flyctl misinterprets Dockerfile URLs in [build] section as local paths
  • Add URL detection and download functionality for Dockerfile URLs
  • Implement comprehensive error handling for HTTP requests

Changes Made

  • Modified resolveDockerfilePath() to detect and handle HTTP/HTTPS URLs
  • Added downloadDockerfileFromURL() to download Dockerfiles from URLs to temporary files
  • Added isURL() helper function to validate URL format
  • Enhanced test coverage with comprehensive test cases for URL and local path scenarios

Test Coverage

  • ✅ Local Dockerfile path resolution (existing functionality)
  • ✅ HTTP/HTTPS URL Dockerfile download
  • ✅ Error handling for 404 responses
  • ✅ URL validation edge cases
  • ✅ All existing tests continue to pass

Fixes

Closes #4464

Test Plan

  • Run existing tests to ensure no regressions
  • Test URL-based Dockerfile download functionality
  • Test error handling for invalid URLs and HTTP errors
  • Verify lint and formatting compliance

🤖 Generated with Claude Code

This fixes an issue where flyctl would incorrectly treat URLs specified
in the [build] section's dockerfile parameter as local paths, causing
builds to fail with "Dockerfile not found" errors.

Changes:
- Add URL detection for Dockerfile paths in resolveDockerfilePath()
- Implement downloadDockerfileFromURL() to fetch Dockerfiles from URLs
- Add comprehensive tests for URL and local path handling
- Support both HTTP and HTTPS URLs with proper error handling

Fixes: #4464

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
// Download the Dockerfile
resp, err := http.Get(dockerfileURL)
if err != nil {
os.Remove(tempFile.Name())
Copy link
Member

Choose a reason for hiding this comment

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

Can you move os.Remove() to defer? You can check err in defer to see whether the function is successfully finished or not.

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.

flyctl v0.3.149 misinterprets Dockerfile URL in [build] as a local path
2 participants