RUN mkdir /app
WORKDIR /app
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# Build the Go app
RUN go build -o ./out/go-sample-app .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main app/server.go
# This container exposes port 8080 to the outside world
EXPOSE 8080
# Run the binary program produced by `go install`
CMD ["go", "run, "server.go"]
The error which I am getting is this. So I've been trying to write a Dockerfile for the first time for my Golang App and this is the issue I am running into.
time="2020-10-06T07:03:55+05:30" level=error msg="Can't add file \\\\?\\D:\\0 NAT IT\\DumGo\\.git\\hooks\\update.sample to tar: io: read/write on closed pipe"
time="2020-10-06T07:03:55+05:30" level=error msg="Can't close tar writer: io: read/write on closed pipe"
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=zuyf430dft91rrte7rvtw9kjg&shmsize=0&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
The file structure is like
~DumGo
/graph
Dockerfile
go.mod
go.sum
server.go