Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply same docker image to multiple containers within the same task definition #68

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
7 changes: 6 additions & 1 deletion ecs/task_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,15 @@ func (ecs *ECS) DescribeTaskDefinition(taskDefinitionArn string) *awsecs.Describ
//UpdateTaskDefinitionImage registers a new task definition with the updated image
func (ecs *ECS) UpdateTaskDefinitionImage(taskDefinitionArn, image string) string {
dtd := ecs.DescribeTaskDefinition(taskDefinitionArn)
dtd.TaskDefinition.ContainerDefinitions[0].Image = aws.String(image)
for i := 0; i < len(dtd.TaskDefinition.ContainerDefinitions); i++ {
dtd.TaskDefinition.ContainerDefinitions[i].Image = aws.String(image)
}

return ecs.registerTaskDefinition(dtd)
}



//UpdateTaskDefinitionImageAndEnvVars creates a new, updated task definition
// based on the specified image and env vars.
// Note that any existing envvars are replaced by the new ones
Expand Down
29 changes: 29 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
set -e

uname=$(uname)
suffix=
case "$uname" in
Darwin) suffix=darwin_amd64;;
Linux) suffix=linux_amd64;;
*) echo >&2 "$0: Unrecognized platform '$uname'; aborting install."; exit 1;;
esac

which curl >/dev/null 2>&1|| {
echo >&2 "$0: curl not found. Unable to proceed."
exit 1
}

org=dormantroot
app=fargate
api_url=https://api.github.com/repos/$org/$app/releases/latest
version=$(curl -s "$api_url" | awk -F\" '/tag_name/ {print $4}')

bin_url=https://github.com/$org/$app/releases/download/$version/ncd_$suffix
echo "Getting $bin_url"
echo "(If you are prompted for a password, enter the one you use"
echo " to log into this machine)"
sudo curl -sSLo "/usr/local/bin/$app" "$bin_url"
sudo chmod +rx "/usr/local/bin/$app"

echo "$app installed to /usr/local/bin"