diff --git a/Dockerfile b/Dockerfile index 3dbff57..31d3a75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,12 @@ RUN mkdir -p /go/src/folder WORKDIR /go/src/folder COPY /src . -RUN go get -d -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main . +RUN go get -u ./... +RUN go build FROM alpine:latest WORKDIR / -COPY --from=builder /go/src/folder/main . +COPY --from=builder /go/src/folder/weatherservice . EXPOSE 8080 -CMD ["/main"] +CMD ["/weatherservice"] diff --git a/src/client/WeatherClient.go b/src/client/WeatherClient.go index 5a21bfb..a76370a 100644 --- a/src/client/WeatherClient.go +++ b/src/client/WeatherClient.go @@ -1,9 +1,9 @@ package client import ( - "../config" "encoding/json" "io/ioutil" + "joethei.xyz/weather/config" "log" "net/http" "strconv" diff --git a/src/client/go.mod b/src/client/go.mod new file mode 100644 index 0000000..67c7bbc --- /dev/null +++ b/src/client/go.mod @@ -0,0 +1,3 @@ +module client + +go 1.14 diff --git a/src/config/go.mod b/src/config/go.mod new file mode 100644 index 0000000..4a5b1fd --- /dev/null +++ b/src/config/go.mod @@ -0,0 +1 @@ +module config \ No newline at end of file diff --git a/src/main.go b/src/main.go index c56ddc6..25cb252 100644 --- a/src/main.go +++ b/src/main.go @@ -1,9 +1,9 @@ package main import ( - "./config" - "./server" "github.com/getsentry/sentry-go" + "joethei.xyz/weather/config" + "joethei.xyz/weather/server" ) func main() { diff --git a/src/server/WeatherServer.go b/src/server/WeatherServer.go index d472852..9c694d1 100644 --- a/src/server/WeatherServer.go +++ b/src/server/WeatherServer.go @@ -1,8 +1,6 @@ package server import ( - "../client" - "../config" "encoding/json" "github.com/auth0/go-jwt-middleware" "github.com/dgrijalva/jwt-go" @@ -14,6 +12,8 @@ import ( "github.com/throttled/throttled/store/memstore" "github.com/victorspringer/http-cache" "github.com/victorspringer/http-cache/adapter/memory" + "joethei.xyz/weather/client" + "joethei.xyz/weather/config" "log" "net/http" "strconv" diff --git a/src/server/go.mod b/src/server/go.mod new file mode 100644 index 0000000..fbd4b59 --- /dev/null +++ b/src/server/go.mod @@ -0,0 +1,13 @@ +module server + +go 1.14 + +require ( + github.com/auth0/go-jwt-middleware v0.0.0-20200507191422-d30d7b9ece63 // indirect + github.com/getsentry/sentry-go v0.6.1 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/justinas/alice v1.2.0 // indirect + github.com/justinas/nosurf v1.1.0 // indirect + github.com/throttled/throttled v2.2.4+incompatible // indirect + github.com/victorspringer/http-cache v0.0.0-20190721184638-fe78e97af707 // indirect +)