I'm trying to run a container from a dockerfile and a docker-compose file which look like this -
docker-compose.yml
build:
context: .
dockerfile: docker/Dockerfile
target: go-container
entrypoint: bash -c "./main"
the Dockerfile looks like this -
ARG GO_VERSION=1.17
FROM golang:$GO_VERSION as go-container
ENV GOPATH /gopath
ENV PATH $GOPATH/bin:$PATH
WORKDIR /gopath/src/project
ADD go.mod go.sum ./
RUN go mod download -x
RUN go build -o main cmd/main.go
FROM scratch as another_container
COPY --from=go-container /gopath/src/project/main .
ENTRYPOINT ["./main"]
On running the docker-compose, I get an error like this -
bash: line 1: ./main: No such file or directory
ERROR: 127
What is happening here? I don't know how to debug it so any help is appreciated!