Run version command during docker build

This commit is contained in:
zikaeroh 2020-07-07 22:54:38 -07:00
parent b76b2b4507
commit 5aa7a79d80
2 changed files with 8 additions and 0 deletions

View File

@ -35,3 +35,6 @@ FROM gcr.io/distroless/base:nonroot
COPY --from=GO_BUILD /codies/codies /codies
ENTRYPOINT [ "/codies", "--prod" ]
EXPOSE 5000
# Verify that the binary works.
RUN [ "/codies", "version" ]

View File

@ -39,6 +39,11 @@ var args = struct {
var wsOpts *websocket.AcceptOptions
func main() {
if argv := os.Args[1:]; len(argv) > 0 && argv[0] == "version" {
fmt.Println(version.Version())
return
}
rand.Seed(time.Now().Unix())
if _, err := flags.Parse(&args); err != nil {