Skip to content

Commit 44c9f2f

Browse files
committed
set platform
1 parent f502460 commit 44c9f2f

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2024"
33
name = "rops"
4-
version = "0.4.7"
4+
version = "0.5.0"
55

66
[dependencies]
77
base64 = "0.22.1"

src/docker.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fn _default_docker_git_sha_arg() -> Option<String> {
3737
get_default_from_env("DOCKER_GIT_SHA_ARG", None)
3838
}
3939

40-
4140
#[derive(clap::Subcommand, Debug, Clone)]
4241
pub enum DockerCommand {
4342
/// Build a new Docker image
@@ -58,7 +57,7 @@ pub enum DockerCommand {
5857
Push {
5958
/// Image name
6059
name: String,
61-
/// Architecture
60+
/// Add architecture suffix to image tag (e.g. -amd64, -arm64)
6261
#[arg(long, action = clap::ArgAction::SetTrue)]
6362
arch: bool,
6463
},
@@ -94,6 +93,8 @@ impl DockerCommand {
9493
.arg("build")
9594
.arg("-f")
9695
.arg(&dockerfile)
96+
.arg("--platform")
97+
.arg(settings.system.to_string())
9798
.arg("-t")
9899
.arg(&image_name);
99100

src/system.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use serde::{Deserialize, Serialize};
2-
use std::process::Command;
2+
use std::{process::Command};
33

44
#[derive(Debug, Clone, Deserialize, Serialize)]
55
pub struct CurrentSystem {
@@ -19,6 +19,13 @@ impl Default for CurrentSystem {
1919
}
2020
}
2121

22+
impl std::fmt::Display for CurrentSystem {
23+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24+
write!(f, "{}/{}", self.os, self.arch)?;
25+
Ok(())
26+
}
27+
}
28+
2229
impl CurrentSystem {
2330
/// Derives the system architecture by executing `uname -m` and maps `x86_64` to `amd64`.
2431
fn get_arch() -> (String, Option<String>) {

0 commit comments

Comments
 (0)