I have created a program in Go which receives to arguments, project_id
and private_token
. Basically that is how I do it:
project_id := flag.String("project", "", "The id of the project")
private_token := flag.String("pat", "", "The personal access token with api and read user permissions")
flag.Parse()
I have created the following docker image:
FROM golang:1.16-alpine
WORKDIR /app
COPY . /app
RUN go build
ENV PROJECT=""
ENV PRIVATE_TOKEN=""
ENTRYPOINT "./my-program" "-project" $PROJECT "-pat" $PRIVATE_TOKEN
I run the image by running:
docker run -e PROJECT=29065042 -e PRIVATE_TOKEN="glpat-1CHf9T8Nz98W8ZzyT7V4" --rm -it my-image-name
As you can see, I'm passing a private token, which is a sensitive data. I wanted to know if this is the best approach of passing sensitive data from docker to my go program or if there is a better pattern?