Collects environment variables to pass to the container
()
| 14 | |
| 15 | /// Collects environment variables to pass to the container |
| 16 | fn get_docker_env_vars() -> Vec<(String, String)> { |
| 17 | let mut env_vars = Vec::new(); |
| 18 | |
| 19 | // Add some useful default variables |
| 20 | env_vars.push(("DOCKER_BUILDKIT".to_string(), "1".to_string())); |
| 21 | |
| 22 | // Add PATH with some useful directories |
| 23 | let mut env_path = env::var("PATH").unwrap_or_default(); |
| 24 | // TODO: sidecar docker binaries instead of relying on external ones |
| 25 | env_path.push_str(":~/.docker/bin:~/.orbstack/bin/docker:/Applications/OrbStack.app/Contents/MacOS/xbin:/Applications/Docker.app/Contents/Resources/bin"); |
| 26 | info!("Adding PATH: {}", env_path); |
| 27 | env_vars.push(("PATH".to_string(), env_path)); |
| 28 | |
| 29 | // Pass through specific environment variables from host |
| 30 | for (key, value) in env::vars() { |
| 31 | // Pass through variables starting with specific prefixes |
| 32 | if key.starts_with("STACK_") { |
| 33 | info!("Adding variable: {}={}", key, value); |
| 34 | env_vars.push((key, value)); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | debug!("Environment variables: {:?}", env_vars); |
| 39 | env_vars |
| 40 | } |
| 41 | |
| 42 | /// Creates a tar archive from a directory |
| 43 | fn create_archive(source_path: &Path, output_path: &Path) -> std::io::Result<()> { |