diff --git a/Dockerfile b/Dockerfile index 04f258c..70a11cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # first stage: build kwkhtmltopdf_server -FROM golang:1.18.3 +FROM golang:1.21.5 RUN mkdir /tmp/kwkhtml WORKDIR /tmp/kwkhtml COPY server/kwkhtmltopdf_server.go . RUN go mod init kwkhtml -RUN go get -u github.com/rs/zerolog/log@v1.27.0 +RUN go get -u github.com/rs/zerolog/log@v1.31.0 RUN go get -u github.com/pkg/errors@v0.9.1 RUN go build kwkhtmltopdf_server.go @@ -18,7 +18,7 @@ RUN set -x \ && apt update \ && apt -y install --no-install-recommends wget ca-certificates fonts-liberation2 fonts-nanum-coding fonts-horai-umefont fonts-wqy-microhei \ && wget -q -O /tmp/wkhtmltox.deb https://github.com/odoo/wkhtmltopdf/releases/download/nightly/wkhtmltox_0.13.0-1.nightly.bookworm_amd64.deb \ - && echo "a8f28ec5a71d18a4791e48ece56ad7395fd0f935 /tmp/wkhtmltox.deb" | sha1sum -c - \ + && echo "8b3e6ec574f31e4f19644f2c9e00bb929a1cb207 /tmp/wkhtmltox.deb" | sha1sum -c - \ && apt -y install /tmp/wkhtmltox.deb \ && apt -y purge wget --autoremove \ && apt -y clean \ diff --git a/HISTORY.md b/HISTORY.md index 802d39e..3057d04 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ + +# 2.0.1 (2024-01-05) + +Use new build from odoo for wkhtmltopdf bin, use new bookworm debian +Bump zerolog extra go package + # 0.9.3 (2020-04-15) Remove gsfonts and xfonts-100dpi. Use fonts-liberation2 instead diff --git a/server/kwkhtmltopdf_server.go b/server/kwkhtmltopdf_server.go index 860feeb..46dbda2 100644 --- a/server/kwkhtmltopdf_server.go +++ b/server/kwkhtmltopdf_server.go @@ -75,6 +75,7 @@ func httpAbort(w http.ResponseWriter, err error, addr string) { func handler(w http.ResponseWriter, r *http.Request) { debug_enabled := os.Getenv("DEBUG") + no_storage_cleaning := os.Getenv("NO_STORAGE_CLEANING") if debug_enabled != "" { log.Info().Str("Method", r.Method).Str("Url",r.URL.Path).Msg("Parameters") } @@ -108,8 +109,11 @@ func handler(w http.ResponseWriter, r *http.Request) { httpError(w, err, http.StatusNotFound, addr) return } - defer os.RemoveAll(tmpdir) - + // Test if we want to remove storage, in case of debugging + // + if len(no_storage_cleaning) == 0 { + defer os.RemoveAll(tmpdir) + } // parse request reader, err := r.MultipartReader() if err != nil {