diff --git a/.gitignore b/.gitignore index e4aee47..9efc485 100644 --- a/.gitignore +++ b/.gitignore @@ -17,8 +17,7 @@ # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 .glide/ -main.go -maincopy.go +copy_files/ # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/build/package/Dockerfile b/build/package/Dockerfile new file mode 100644 index 0000000..d6a0370 --- /dev/null +++ b/build/package/Dockerfile @@ -0,0 +1,25 @@ +# syntax=docker/dockerfile:1 + +FROM golang:1.19 + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/app ./cmd/app + +# Second stage: use a minimal image +FROM alpine:latest + +WORKDIR / + +RUN apk add --no-cache ca-certificates + +COPY --from=builder /app/app /app + +EXPOSE 8080 + +ENTRYPOINT ["/app"] \ No newline at end of file diff --git a/cmd/presenSe/presense.go b/cmd/presenSe/presense.go index b6cff15..01ac56e 100644 --- a/cmd/presenSe/presense.go +++ b/cmd/presenSe/presense.go @@ -23,7 +23,7 @@ import ( func main() { sigc := make(chan os.Signal, 1) - signal.Notify(sigc, os.Interrupt, os.Kill) + signal.Notify(sigc, os.Interrupt) cfg := config.Load() db, err := bolt.Open("presence.db", 0644, nil)