def test_build_command_with_cache_from(self): ecr = ECR("aws-region", "test-repo", "12345", version="v1", cache_from=['image1', 'image2']) assert 'docker build -t test:v1 --cache-from image1 --cache-from image2 .' == ecr._build_command("test:v1")
def test_build_command_with_dockerfile_without_build_args(self): ecr = ECR("aws-region", "test-repo", "12345", None, None, dockerfile='CustomDockerfile') assert 'docker build -f CustomDockerfile -t test:v1 .' == ecr._build_command("test:v1")
def test_build_command_with_build_args(self): ecr = ECR("aws-region", "test-repo", "12345", None, None, build_args={"SSH_KEY": "\"`cat ~/.ssh/id_rsa`\"", "A": "1"}) assert ecr._build_command("test:v1") == 'docker build -t test:v1 --build-arg SSH_KEY="`cat ~/.ssh/id_rsa`"' \ ' --build-arg A=1 .'
def test_use_dockerfile_with_build_args(self): ecr = ECR("aws-region", "test-repo", "12345", None, None, build_args={"SSH_KEY": "\"`cat ~/.ssh/id_rsa`\"", "A": "1"}, dockerfile='CustomDockerfile') assert ecr._build_command("test:v1") == 'docker build -f CustomDockerfile -t test:v1 ' \ '--build-arg SSH_KEY="`cat ~/.ssh/id_rsa`" --build-arg A=1 .'
def test_build_command_without_build_args(self): ecr = ECR("aws-region", "test-repo", "12345", None, None) assert 'docker build -t test:v1 .' == ecr._build_command("test:v1")