When I use multi stage in Docker, it cannot find the container config file, but when I use only the first stage, the container works fine. I need this as I'm going to reduce the size for the deployment phase, but I couldn't find a solution. I have no problem reading the config file in my local. Here is my docker file
FROM golang:1.18.3-alpine AS builder
WORKDIR /app/policy-manangement-service
ENV GO111MODULE=on
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o /policy-manangement-service ./cmd/policy-management
FROM alpine:latest
COPY --from=builder /policy-manangement-service ./
ENTRYPOINT ["./policy-manangement-service"]
and my error:
{"app-name":"policy-management-service","error":"Config File \"local\" Not Found in \"[/configs]\"","level":"fatal","message":"Error while reading configs","time":"2022-07-12T14:27:58.486529597Z"}
my project structure:
cmd
- policy-manangement
-- main
configs
- local.yaml
internal