I am using docker-compose to run my golang app.
Here is my Dockerfile
FROM golang:1.13 WORKDIR /app COPY go.mod ./ RUN go mod download COPY . . RUN go build -o main . CMD ["/app/main"]
and my docker-compose.yml
version: '3.7' services: app: build: ./myapp container_name: myapp volumes: - ./myapp:/app
When I run
docker-compose build The
main file not appear on
docker-compose up myapp not work, because
main file not found.
docker run mypp can work. How can i build main.go in dockerfile and stay the
main in my host?