2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2025-06-24 14:12:27 +00:00

arm64 support with grub-efi

* build / convert: add `--platform` flag to support linux/amd64 &
linux/arm64
* build: add `--pull` flag
* run/hetzner: add `--type` flag to select server type
* run/hetzner: add `--location` flag to select server location

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2023-09-13 15:37:29 +02:00
parent f8fc729486
commit d54b3f9a2c
29 changed files with 197 additions and 83 deletions

View File

@ -50,11 +50,14 @@ func CmdOut(ctx context.Context, args ...string) (string, string, error) {
return exec.RunOut(ctx, "docker", args...)
}
func Build(ctx context.Context, tag, dockerfile, dir string, buildArgs ...string) error {
func Build(ctx context.Context, pull bool, tag, dockerfile, dir, platform string, buildArgs ...string) error {
if dockerfile == "" {
dockerfile = filepath.Join(dir, "Dockerfile")
}
args := []string{"image", "build", "-t", tag, "-f", dockerfile}
args := []string{"image", "build", "-t", tag, "-f", dockerfile, "--platform", platform}
if pull {
args = append(args, "--pull")
}
for _, v := range buildArgs {
args = append(args, "--build-arg", v)
}
@ -96,8 +99,8 @@ func ImageSave(ctx context.Context, tag, file string) error {
return Cmd(ctx, "image", "save", "-o", file, tag)
}
func Pull(ctx context.Context, tag string) error {
return Cmd(ctx, "image", "pull", tag)
func Pull(ctx context.Context, platform, tag string) error {
return Cmd(ctx, "image", "pull", "--platform", platform, tag)
}
func Push(ctx context.Context, tag string) error {