Closed chadell closed 6 years ago
we should also tag the docker image accordingly, right?
@dcaba regarding docker image tag, we are already doing it in https://github.com/dachad/tcpgoon/blob/master/_script/deploy#L27, isn't it?
@dcaba check if you like using "commands", I have gone for "version" and "run", we could add other ones if needed
% ./tcpgoon --help
tcpgoon tests concurrent connections towards a server listening on a TCP port
Usage:
tcpgoon [command]
Available Commands:
help Help about any command
run Run tcpgoon test
version Show tcpgoon version
Flags:
-h, --help help for tcpgoon
Use "tcpgoon [command] --help" for more information about a command.
%./tcpgoon run
Usage:
tcpgoon run [flags] <host> <port>
Flags:
-y, --assume-yes Force execution without asking for confirmation
-c, --connections int Number of connections you want to open (default 100)
-d, --debug Print debugging information to the standard error
-t, --dial-timeout int Connection dialing timeout, in ms (default 5000)
-h, --help help for run
-i, --interval int Interval, in seconds, between stats updates (default 1)
-s, --sleep int Time you want to sleep between connections, in ms (default 10)
Commands look good! But the docker image id... its using the abbreviated git commit form, as I'm suggestion to do also with the binary/compilation. In addition, maybe we should not pick the commit id again from git, but pass this as a parameter from the build to the deploy (to enforce and guarantee they do have the same value)
it works executing a local deploy:
+ go build -o out/tcpgoon -ldflags '-X '\''main.buildstamp=2018-01-15_09:09:45PM'\'' -X '\''main.githash=47630ee'\'' -extldflags '\''-static'\''' -a -installsuffix nocgo -tags netgo
+ docker_build dachad/tcpgoon
+ tag=dachad/tcpgoon
+ execgroup=docker
+ sg docker 'docker build -t dachad/tcpgoon .'
Sending build context to Docker daemon 10.1 MB
Step 1/5 : FROM scratch
--->
Step 2/5 : MAINTAINER devops-training-bcn@googlegroups.com
---> Running in 2879c13b9d29
INFO[0011] Layer sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef cleaned up
---> 88b72ba93ffb
Removing intermediate container 2879c13b9d29
Step 3/5 : COPY out/tcpgoon /
---> a31e100f9c7e
Removing intermediate container 675c41a7bc75
Step 4/5 : ENTRYPOINT /tcpgoon
---> Running in ec3cabc80886
INFO[0013] Layer sha256:40cd43b2ce5ade695b22a0688b966c3b92fbe8d1aada0ec77f287d8da309349b cleaned up
---> 915226431db1
Removing intermediate container ec3cabc80886
Step 5/5 : CMD --help
---> Running in ea34dc036140
INFO[0014] Layer sha256:40cd43b2ce5ade695b22a0688b966c3b92fbe8d1aada0ec77f287d8da309349b cleaned up
---> 314a82606e96
Removing intermediate container ea34dc036140
Successfully built 314a82606e96
+ ./_script/deploy dachad/tcpgoon 47630ee
INFO: Valid docker credentials file found. We will try to use it
The push refers to a repository [docker.io/dachad/tcpgoon]
26d63c95eab2: Pushed
47630ee: digest: sha256:f27aa40bef51e2c98d99f213954bfbebbf2695e4d940f988d770d771c67830a8 size: 528
The push refers to a repository [docker.io/dachad/tcpgoon]
26d63c95eab2: Layer already exists
47630ee: digest: sha256:f27aa40bef51e2c98d99f213954bfbebbf2695e4d940f988d770d771c67830a8 size: 528
26d63c95eab2: Layer already exists
latest: digest: sha256:f27aa40bef51e2c98d99f213954bfbebbf2695e4d940f988d770d771c67830a8 size: 528
caba@caba-ThinkPad-T450s ~/goWork/src/github.com/dachad/tcpgoon
%
caba@caba-ThinkPad-T450s ~/goWork/src/github.com/dachad/tcpgoon
% ./out/tcpgoon version
Git Commit Hash: 47630ee
UTC Build Time: 2018-01-15_09:09:45PM
caba@caba-ThinkPad-T450s ~/goWork/src/github.com/dachad/tcpgoon
% docker pull dachad/tcpgoon:latest
latest: Pulling from dachad/tcpgoon
0eb6b3702415: Pull complete
Digest: sha256:f27aa40bef51e2c98d99f213954bfbebbf2695e4d940f988d770d771c67830a8
Status: Downloaded newer image for dachad/tcpgoon:latest
caba@caba-ThinkPad-T450s ~/goWork/src/github.com/dachad/tcpgoon
% docker run -ti dachad/tcpgoon:latest version
Git Commit Hash: 47630ee
UTC Build Time: 2018-01-15_09:09:45PM
Merging
dockerhub readme updated
The result is something like this:
If you like this approach I will update the Readme