Trying to run my API on docker, when I run outside docker I don't get any error
Error: => ERROR [6/6] RUN go build -o bin/app cmd/app/main.go 0.5s
[6/6] RUN go build -o bin/app cmd/app/main.go:
10 0.449 go: github.com/gin-gonic/gin@v1.8.1 requires
10 0.449 github.com/go-playground/validator/v10@v10.10.0: missing go.sum entry; to add it:
10 0.449 go mod download github.com/go-playground/validator/v10
Dockerfile FROM golang:1.16-alpine WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN go build -o bin/app cmd/app/main.go EXPOSE 5000 CMD ["./bin/app"]
I have already run the go mod tidy but the issue persists, any idea?
I can see it here on the go.mod
module github.com/jolienai/go-products-api
go 1.18
require ( github.com/gin-gonic/gin v1.8.1 github.com/go-co-op/gocron v1.15.0 github.com/gocarina/gocsv v0.0.0-20220712153207-8b2118da4570 github.com/jinzhu/gorm v1.9.16 go.elastic.co/ecszap v1.0.1 go.uber.org/zap v1.21.0 )
require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/validator/v10 v10.11.0 // indirect github.com/goccy/go-json v0.9.10 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/lib/pq v1.1.1 // indirect github.com/magefile/mage v1.13.0 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/ugorji/go/codec v1.2.7 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect )
Many thanks
Comment From: jolienai
never mind, just updated the image in docker file to FROM golang:latest and it worked