Skip to content

Commit

Permalink
build(Dockerfile): pin platform to linux/amd64
Browse files Browse the repository at this point in the history
Signed-off-by: Nurzhan Sakén <[email protected]>
  • Loading branch information
nxsaken committed Jun 10, 2024
1 parent 6cf6378 commit b2f787b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#base stage
FROM archlinux:base-devel AS builder
FROM --platform=linux/amd64 archlinux:base-devel AS builder

# Force-sync packages, install archlinux-keyring, repopulate keys
RUN pacman -Syy
Expand Down
4 changes: 0 additions & 4 deletions configs/swarm/docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version: '3.8'
services:
irohad0:
build: ../..
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731
Expand Down Expand Up @@ -34,7 +33,6 @@ services:
start_period: 4s
irohad1:
build: ../..
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D
Expand All @@ -57,7 +55,6 @@ services:
start_period: 4s
irohad2:
build: ../..
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E
Expand All @@ -80,7 +77,6 @@ services:
start_period: 4s
irohad3:
build: ../..
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E
Expand Down
1 change: 0 additions & 1 deletion configs/swarm/docker-compose.single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version: '3.8'
services:
irohad0:
build: ../..
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731
Expand Down
4 changes: 0 additions & 4 deletions configs/swarm/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version: '3.8'
services:
irohad0:
image: hyperledger/iroha:dev
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731
Expand Down Expand Up @@ -34,7 +33,6 @@ services:
start_period: 4s
irohad1:
image: hyperledger/iroha:dev
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D
Expand All @@ -57,7 +55,6 @@ services:
start_period: 4s
irohad2:
image: hyperledger/iroha:dev
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E
Expand All @@ -80,7 +77,6 @@ services:
start_period: 4s
irohad3:
image: hyperledger/iroha:dev
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E
Expand Down
23 changes: 1 addition & 22 deletions tools/swarm/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use serde::{ser::SerializeMap, Serialize, Serializer};

use crate::{cli::SourceParsed, util::AbsolutePath};

/// Config directory inside of the docker image
/// Config directory inside the docker image
const DIR_CONFIG_IN_DOCKER: &str = "/config";
const GENESIS_KEYPAIR_SEED: &[u8; 7] = b"genesis";
const GENESIS_SIGNED_FILE: &str = "/tmp/genesis.signed.scale";
Expand All @@ -25,7 +25,6 @@ kagami genesis sign /config/genesis.json --public-key $$GENESIS_PUBLIC_KEY --pri
irohad --submit-genesis
""#;
const DOCKER_COMPOSE_VERSION: &str = "3.8";
const PLATFORM_ARCHITECTURE: &str = "linux/amd64";

#[derive(Serialize, Debug)]
pub struct DockerCompose {
Expand Down Expand Up @@ -76,18 +75,6 @@ impl Serialize for DockerComposeVersion {
}
}

#[derive(Debug)]
struct PlatformArchitecture;

impl Serialize for PlatformArchitecture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(PLATFORM_ARCHITECTURE)
}
}

pub struct DockerComposeServiceBuilder {
chain_id: ChainId,
peer: Peer,
Expand All @@ -103,7 +90,6 @@ pub struct DockerComposeServiceBuilder {
pub struct DockerComposeService {
#[serde(flatten)]
source: ServiceSource,
platform: PlatformArchitecture,
environment: FullPeerEnv,
ports: Vec<PairColon<u16, u16>>,
volumes: Vec<PairColon<String, String>>,
Expand Down Expand Up @@ -183,7 +169,6 @@ impl DockerComposeServiceBuilder {

DockerComposeService {
source,
platform: PlatformArchitecture,
command,
init: AlwaysTrue,
volumes: volumes.into_iter().map(|(a, b)| PairColon(a, b)).collect(),
Expand Down Expand Up @@ -633,7 +618,6 @@ mod tests {
map.insert(
"iroha0".to_owned(),
DockerComposeService {
platform: PlatformArchitecture,
source: ServiceSource::Build(PathBuf::from(".")),
environment: CompactPeerEnv {
chain_id,
Expand Down Expand Up @@ -673,7 +657,6 @@ mod tests {
services:
iroha0:
build: .
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed012039E5BF092186FACC358770792A493CA98A83740643A3D41389483CF334F748C8
Expand Down Expand Up @@ -757,7 +740,6 @@ mod tests {
services:
irohad0:
build: ./iroha-cloned
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611
Expand Down Expand Up @@ -786,7 +768,6 @@ mod tests {
start_period: 4s
irohad1:
build: ./iroha-cloned
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883
Expand All @@ -809,7 +790,6 @@ mod tests {
start_period: 4s
irohad2:
build: ./iroha-cloned
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32
Expand All @@ -832,7 +812,6 @@ mod tests {
start_period: 4s
irohad3:
build: ./iroha-cloned
platform: linux/amd64
environment:
CHAIN_ID: 00000000-0000-0000-0000-000000000000
PUBLIC_KEY: ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B
Expand Down

0 comments on commit b2f787b

Please sign in to comment.