github.com/MetalBlockchain/metalgo@v1.11.9/tests/antithesis/avalanchego/gencomposeconfig/main.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package main
     5  
     6  import (
     7  	"fmt"
     8  	"log"
     9  	"os"
    10  
    11  	"github.com/MetalBlockchain/metalgo/tests/antithesis"
    12  	"github.com/MetalBlockchain/metalgo/tests/fixture/tmpnet"
    13  )
    14  
    15  const baseImageName = "antithesis-avalanchego"
    16  
    17  // Creates docker-compose.yml and its associated volumes in the target path.
    18  func main() {
    19  	targetPath := os.Getenv("TARGET_PATH")
    20  	if len(targetPath) == 0 {
    21  		log.Fatal("TARGET_PATH environment variable not set")
    22  	}
    23  
    24  	imageTag := os.Getenv("IMAGE_TAG")
    25  	if len(imageTag) == 0 {
    26  		log.Fatal("IMAGE_TAG environment variable not set")
    27  	}
    28  
    29  	nodeImageName := fmt.Sprintf("%s-node:%s", baseImageName, imageTag)
    30  	workloadImageName := fmt.Sprintf("%s-workload:%s", baseImageName, imageTag)
    31  
    32  	network := tmpnet.LocalNetworkOrPanic()
    33  	err := antithesis.GenerateComposeConfig(network, nodeImageName, workloadImageName, targetPath)
    34  	if err != nil {
    35  		log.Fatalf("failed to generate config for docker-compose: %s", err)
    36  	}
    37  }