@@ -160,6 +160,13 @@ extension VercelOutput {
160160 argument ( " port " ) ?? " 7676 "
161161 }
162162
163+ public var architecture : Architecture {
164+ if let value = argument ( " arch " ) , let arch = Architecture ( rawValue: value) {
165+ return arch
166+ }
167+ return Utils . currentArchitecture ?? . x86
168+ }
169+
163170 public func argument( _ key: String ) -> String ? {
164171 guard let index = arguments. firstIndex ( of: " -- \( key) " ) else {
165172 return nil
@@ -368,11 +375,11 @@ extension VercelOutput {
368375 let vercel = vercelConfiguration ( )
369376 let routes : [ OutputConfiguration . Route ] = [
370377 // Remove trailing slash
371- . init( src: " ^/(.* )/$ " , headers: [ " Location " : " /$1 " ] , status: 308 ) ,
378+ . init( src: " ^(?:/((?:[^/]+?)(?:/(?:[^/]+?))*) )/$ " , headers: [ " Location " : " /$1 " ] , status: 308 ) ,
372379 // Handle filesystem
373380 . init( handle: " filesystem " ) ,
374381 // Proxy all other routes
375- . init( src: " ^(?:/(.*)) $ " , dest: product. name, check: true )
382+ . init( src: " ^.* $ " , dest: product. name, check: true )
376383 ]
377384 let config = OutputConfiguration (
378385 routes: routes,
@@ -415,6 +422,7 @@ extension VercelOutput {
415422 public struct FunctionConfiguration : Codable {
416423 public var runtime : String = " provided.al2 "
417424 public var handler : String = " bootstrap "
425+ public var architecture : Architecture ? = nil
418426 public var memory : Int ? = nil
419427 public var maxDuration : Int ? = nil
420428 public var regions : [ String ] ? = nil
@@ -427,6 +435,7 @@ extension VercelOutput {
427435
428436 public func writeFunctionConfigurations( ) throws {
429437 let config = FunctionConfiguration (
438+ architecture: architecture,
430439 memory: . init( functionMemory) ,
431440 maxDuration: . init( functionDuration) ,
432441 regions: functionRegions? . components ( separatedBy: " , " ) . map { $0. trimmingCharacters ( in: . whitespacesAndNewlines) }
@@ -511,7 +520,7 @@ extension VercelOutput {
511520 executable: dockerToolPath,
512521 arguments: [
513522 " run " ,
514- " --platform " , " linux/x86_64 " ,
523+ " --platform " , " linux/ \( architecture . rawValue ) " ,
515524 " --rm " ,
516525 " -v " , " \( context. package . directory. string) :/workspace " ,
517526 " -w " , " /workspace " ,
@@ -529,7 +538,7 @@ extension VercelOutput {
529538 executable: dockerToolPath,
530539 arguments: [
531540 " run " ,
532- " --platform " , " linux/x86_64 " ,
541+ " --platform " , " linux/ \( architecture . rawValue ) " ,
533542 " --rm " ,
534543 " -v " , " \( context. package . directory. string) :/workspace " ,
535544 " -w " , " /workspace " ,
0 commit comments