version: '3' vars: SERVER_APP: greeter_server REGISTRY: "" REPOSITORY: aws-samples TAG: latest tasks: build: desc: Build the go binary. cmds: - go install . env: CGO_ENABLED: 0 sources: - ./*.go generates: - ./{{.SERVER_APP}}{{exeExt}} method: checksum clean: desc: Deletes the go binary. cmds: - go clean -i . build-container: desc: Build the Docker container locally. cmds: - docker build -t {{.REGISTRY}}{{if ne .REGISTRY ""}}/{{end}}{{.REPOSITORY}}{{if ne .REPOSITORY ""}}/{{end}}{{.SERVER_APP}}:{{.TAG}} . buildx-container: desc: Builds and pushes the multi-architecture image. cmds: - docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag {{.REGISTRY}}{{if ne .REGISTRY ""}}/{{end}}{{.REPOSITORY}}{{if ne .REPOSITORY ""}}/{{end}}{{.SERVER_APP}}:{{.TAG}} --push . run-container: desc: Run the Docker container locally. cmds: - docker run -d --name {{.SERVER_APP}} -p 50051:50051 {{.REGISTRY}}{{if ne .REGISTRY ""}}/{{end}}{{.REPOSITORY}}{{if ne .REPOSITORY ""}}/{{end}}{{.SERVER_APP}}:{{.TAG}} clean-container: desc: Stops and removes the container locally. cmds: - cmd: docker stop {{.SERVER_APP}} > /dev/null 2>&1 ignore_error: true - cmd: docker rm {{.SERVER_APP}} > /dev/null 2>&1 ignore_error: true