I want to run a simple go script in a docker container. The script has some flags like the two examples bellow.
Flags:
dataSource := flag.String("input", "", "Path")
...
concurrency := flag.Int("concurrency", 10, "Concurrency")
flag.Parse()
Some flags have defaults set and are optional. Others are mandatory to be set by the user. How would I pass arguments in the docker run command to the go script without having the user to enter all arguments?
Dockerfile:
FROM golang:alpine AS builder
RUN apk update && apk add --no-cache git
WORKDIR $GOPATH/go/src/app
ENV GOBIN=/usr/local/bin
COPY . .
RUN go get github.com/lib/pq
RUN go build -o /go/bin/Import
FROM scratch
COPY --from=builder /go/bin/Import /go/bin/Import
ENTRYPOINT ["/go/bin/Import""]
I've read the docs about ENTRYPOINT but could not find anything suitable for me. Is it even possible or doesn't it make sense?
I've read through posts like this one: Pass optional arguments when running a Docker image . They simply pass single arguments, how would I define the default value for those?
Thanks for any help