@@ -41,6 +41,12 @@ async def main() -> None:
4141 runtime = (
4242 os .getenv ("SANDBOX_RUNTIME" ) or "node22"
4343 ) # note: ruby runtime is not supported so we install ruby via dnf
44+ bundle_env = (
45+ "BUNDLE_APP_CONFIG=.bundle "
46+ "BUNDLE_USER_HOME=.bundle-home "
47+ "BUNDLE_PATH=vendor/bundle "
48+ "BUNDLE_CACHE_PATH=vendor/cache"
49+ )
4450
4551 # Rails default port is 3000
4652 port = 3000
@@ -104,6 +110,7 @@ async def main() -> None:
104110 "--skip-action-cable "
105111 "--skip-system-test "
106112 "--skip-git "
113+ "--skip-bundle "
107114 "--force"
108115 ),
109116 ],
@@ -122,7 +129,12 @@ async def main() -> None:
122129 "bash" ,
123130 [
124131 "-lc" ,
125- (f"cd { app_path } && bundle config set --local path vendor/bundle" ),
132+ (
133+ f"cd { app_path } && "
134+ "mkdir -p .bundle-home vendor/cache && "
135+ f"{ bundle_env } bundle config set --local path vendor/bundle && "
136+ f"{ bundle_env } bundle config set --local cache_path vendor/cache"
137+ ),
126138 ],
127139 )
128140 async for line in bundler_cfg_cmd .logs ():
@@ -137,7 +149,7 @@ async def main() -> None:
137149 "bash" ,
138150 [
139151 "-lc" ,
140- (f"cd { app_path } && bundle install --jobs 4 --retry 3" ),
152+ (f"cd { app_path } && { bundle_env } bundle install --jobs 4 --retry 3" ),
141153 ],
142154 )
143155 async for line in bundle_install_cmd .logs ():
@@ -154,7 +166,7 @@ async def main() -> None:
154166 "-lc" ,
155167 (
156168 f"cd { app_path } && "
157- " bundle exec rails generate scaffold Post title:string body:text"
169+ f" { bundle_env } bundle exec rails generate scaffold Post title:string body:text"
158170 ),
159171 ],
160172 )
@@ -183,7 +195,7 @@ async def main() -> None:
183195 "bash" ,
184196 [
185197 "-lc" ,
186- (f"cd { app_path } && bundle exec rails db:migrate" ),
198+ (f"cd { app_path } && { bundle_env } bundle exec rails db:migrate" ),
187199 ],
188200 )
189201 async for line in migrate_cmd .logs ():
@@ -198,7 +210,7 @@ async def main() -> None:
198210 "bash" ,
199211 [
200212 "-lc" ,
201- (f"cd { app_path } && bundle exec rails db:seed" ),
213+ (f"cd { app_path } && { bundle_env } bundle exec rails db:seed" ),
202214 ],
203215 )
204216 async for line in seed_cmd .logs ():
@@ -218,7 +230,8 @@ async def main() -> None:
218230 "-lc" ,
219231 (
220232 f"cd { app_path } && "
221- f"ALLOWED_HOST={ allowed_host } bundle exec rails server -b 0.0.0.0 -p { port } "
233+ f"ALLOWED_HOST={ allowed_host } { bundle_env } "
234+ f"bundle exec rails server -b 0.0.0.0 -p { port } "
222235 ),
223236 ],
224237 )
0 commit comments