I am trying to run my simple golang API in a docker container so that it can be run across all machines, when I use docker tool box to navigate to the directory and run docker-compose up
I get an error saying that stat main.go: no such file or directory
I think it may have to do with the paths on my dockerfile/docker compose? Could anyone take a look and help me out please?
Dockerfile
FROM golang:latest
RUN mkdir -p /go/src/app
WORKDIR /go/src/app
ADD . /go/src/app
RUN go get -v
docker-compose.yml
version: '3'
services:
db:
image: postgres
environment:
POSTGRES_DB: Shoes
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
ports:
- 5432:5432
app:
build: .
command: ["go", "run", "main.go"]
volumes:
- .:/go/src/app
ports:
- "8080:8080"
depends_on:
- db
links:
- db
Edit: New error after rearranging some files and getting my GOPATH working properly. I am having a problem connecting to the Database in docker I get my error message for when I cant connect.