I am creating a docker golang image, but my golang app needs to read a config.yaml on start. I tried to add the file as shown in the dockerfile below:
FROM golang:alpine as builder
# Install git + SSL ca certificates
RUN apk update && apk add git && apk add ca-certificates
# Create appuser
COPY . $GOPATH/src/github.com/user/app/
WORKDIR $GOPATH/src/github.com/user/app/
#get dependancies
RUN go get -d -v
#build the binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/app
# STEP 2 build a small image
# start from scratch
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ADD ./config.yaml /go/bin/app/
# Copy our static executable
COPY --from=builder /go/bin/app /go/bin/app
EXPOSE 3000
ENTRYPOINT ["/go/bin/app"]
But I get the following error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/go/bin/app\": permission denied": unknown.
/go/bin/appbecause permission is denied. Most likely, the execute bit isn't set. - Flimzy/go/bin/appis a directory. - David Maze