Skip to content

Commit

Permalink
support x86_64 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
lionello committed Jun 25, 2024
1 parent 52b1908 commit b8e52c0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pkg/cli/compose/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ func getResourceReservations(r compose.Resources) *compose.Resource {
}

func convertPlatform(platform string) defangv1.Platform {
switch platform {
switch strings.ToLower(platform) {
default:
warnf("unsupported platform: %q (assuming linux)", platform)
warnf("unsupported platform: %q; assuming linux", platform)
fallthrough
case "", "linux":
return defangv1.Platform_LINUX_ANY
case "linux/amd64":
case "linux/amd64", "linux/x86_64": // Docker accepts both
return defangv1.Platform_LINUX_AMD64
case "linux/arm64", "linux/arm64/v8", "linux/arm64/v7", "linux/arm64/v6":
return defangv1.Platform_LINUX_ARM64
Expand Down
4 changes: 4 additions & 0 deletions src/tests/platforms/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
intel2:
platform: LINUX/X86_64
image: busybox
8 changes: 8 additions & 0 deletions src/tests/platforms/compose.yaml.convert
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "intel2",
"image": "busybox",
"internal": true,
"networks": 1
}
]
10 changes: 10 additions & 0 deletions src/tests/platforms/compose.yaml.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: platforms
services:
intel2:
image: busybox
networks:
default: null
platform: LINUX/X86_64
networks:
default:
name: platforms_default
2 changes: 2 additions & 0 deletions src/tests/platforms/compose.yaml.warnings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
level=warning msg="service \"intel2\": missing compose directive: restart; assuming 'unless-stopped' (add 'restart' to silence)"
level=warning msg="service \"intel2\": missing memory reservation; specify deploy.resources.reservations.memory to avoid out-of-memory errors"

0 comments on commit b8e52c0

Please sign in to comment.