Run version command during docker build
This commit is contained in:
parent
b76b2b4507
commit
5aa7a79d80
|
@ -35,3 +35,6 @@ FROM gcr.io/distroless/base:nonroot
|
||||||
COPY --from=GO_BUILD /codies/codies /codies
|
COPY --from=GO_BUILD /codies/codies /codies
|
||||||
ENTRYPOINT [ "/codies", "--prod" ]
|
ENTRYPOINT [ "/codies", "--prod" ]
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
|
# Verify that the binary works.
|
||||||
|
RUN [ "/codies", "version" ]
|
||||||
|
|
5
main.go
5
main.go
|
@ -39,6 +39,11 @@ var args = struct {
|
||||||
var wsOpts *websocket.AcceptOptions
|
var wsOpts *websocket.AcceptOptions
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if argv := os.Args[1:]; len(argv) > 0 && argv[0] == "version" {
|
||||||
|
fmt.Println(version.Version())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
rand.Seed(time.Now().Unix())
|
rand.Seed(time.Now().Unix())
|
||||||
|
|
||||||
if _, err := flags.Parse(&args); err != nil {
|
if _, err := flags.Parse(&args); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue