Support .ramekin/Dockerfile for per-project agent images
Workspace Dockerfile gets the workspace as build context so COPY
instructions work relative to the project root.

Assisted-by: Claude Opus 4.6 via pi
change pyutsrrtlrusvypztruskntprvoxsnyt
commit a416b17147eb88ec47e1a1671d0ca8c1a38232eb
author Alpha Chen <alpha@kejadlen.dev>
date
parent yvpyrwlk
diff --git a/assets/compose.yml b/assets/compose.yml
index 6d8b001..5d90527 100644
--- a/assets/compose.yml
+++ b/assets/compose.yml
@@ -1,8 +1,8 @@
 services:
   agent:
     build:
-      context: .
-      dockerfile: Dockerfile
+      context: "${RAMEKIN_BUILD_CONTEXT:-.}"
+      dockerfile: "${RAMEKIN_DOCKERFILE:-Dockerfile}"
     image: ramekin-agent
     stdin_open: true
     tty: true
diff --git a/src/main.rs b/src/main.rs
index db45279..d5dc0ec 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -57,13 +57,25 @@ fn run() -> Result<()> {
 
     let compose_file = cache_dir.join("compose.yml");
 
+    // Use .ramekin/Dockerfile from workspace if it exists, otherwise use the embedded one
+    let custom_dockerfile = workspace.join(".ramekin/Dockerfile");
+    let (dockerfile, build_context) = if custom_dockerfile.exists() {
+        info!("using custom Dockerfile from .ramekin/Dockerfile");
+        (custom_dockerfile, workspace.clone())
+    } else {
+        info!("using built-in Dockerfile");
+        (cache_dir.join("Dockerfile"), cache_dir.clone())
+    };
+
     let docker_compose = |args: &[&str]| -> Result<Command> {
         let mut cmd = Command::new("docker");
         cmd.args(["compose", "-f"])
             .arg(&compose_file)
             .args(args)
             .env("RAMEKIN_WORKSPACE", &workspace)
-            .env("RAMEKIN_DATA_DIR", &pi_data_dir);
+            .env("RAMEKIN_DATA_DIR", &pi_data_dir)
+            .env("RAMEKIN_DOCKERFILE", &dockerfile)
+            .env("RAMEKIN_BUILD_CONTEXT", &build_context);
         Ok(cmd)
     };