From 516a08a17ee9150220abeec0d5dff72099fd2dcd Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 9 May 2020 15:15:34 -0700 Subject: fix dockerfile envs --- Dockerfile | 6 +++--- db/db.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a14889..41a3dcc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ COPY . /app/src WORKDIR /app/src RUN apk add git ca-certificates -RUN go mod download # Build image RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/app @@ -16,10 +15,11 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/app FROM scratch # Copy app -COPY --from=builder /go/bin/app /go/bin/app +COPY --from=builder /go/bin/app ./ +COPY .env ./ # Expose ports, change port to whatever you need to expose EXPOSE 8080 # Run app -ENTRYPOINT ["/go/bin/app"] \ No newline at end of file +ENTRYPOINT ["./app"] \ No newline at end of file diff --git a/db/db.go b/db/db.go index a6f439e..4a932f5 100644 --- a/db/db.go +++ b/db/db.go @@ -12,7 +12,7 @@ func init() { // load .env file err := godotenv.Load() if err != nil { - log.Fatal("Error loading .env file") + log.Fatal("Error loading .env file: %s", err.Error()) } mUser := os.Getenv("MONGO_USER") -- cgit v1.2.3