Merge branch 'master' of ssh://gitlab.larvit.se:10022/power-plan/auth
This commit is contained in:
commit
8bc519e42b
38
Dockerfile
Normal file
38
Dockerfile
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
FROM golang:1.15.6-alpine AS builder
|
||||||
|
|
||||||
|
# Install missing pkgs
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
|
||||||
|
# Set necessary environmet variables needed for our image
|
||||||
|
ENV GO111MODULE=on \
|
||||||
|
CGO_ENABLED=0 \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64
|
||||||
|
|
||||||
|
# Set workdir in GOPATH
|
||||||
|
WORKDIR $GOPATH/src/gitlab.larvit.se/power-plan/auth
|
||||||
|
|
||||||
|
# Copy and download dependency using go mod
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the source code
|
||||||
|
COPY ./src ./src
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN go build -o /build/main ./src
|
||||||
|
|
||||||
|
# Move to /dist directory as the place for resulting binary folder
|
||||||
|
WORKDIR /dist
|
||||||
|
|
||||||
|
# Copy binary from build to main folder
|
||||||
|
RUN cp /build/main .
|
||||||
|
|
||||||
|
# Build a small image
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /dist/main /
|
||||||
|
|
||||||
|
# Command to run
|
||||||
|
ENTRYPOINT ["/main"]
|
|
@ -36,7 +36,7 @@ func createAdminAccount(Db db.Db) {
|
||||||
func main() {
|
func main() {
|
||||||
err := godotenv.Load()
|
err := godotenv.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error loading .env file")
|
log.Warn("Error loading .env file, this could be ok if the env file does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add this line for logging filename and line number!
|
// Add this line for logging filename and line number!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user