diff --git a/Dockerfile b/Dockerfile
index 6ba81180b7df7cd173c95f46faf8d56140ddc2f7..d46bbc091741fc4e320a395f7dc598d906f58ab2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,6 +8,9 @@ WORKDIR /app
 COPY go.mod go.sum ./
 RUN go mod download
 
+# https://github.com/valyala/gozstd/issues/20#issuecomment-557499034
+RUN GOZSTD_VER=$(cat go.mod | fgrep github.com/valyala/gozstd | awk '{print $NF}'); cd ${GOPATH}/pkg/mod/github.com/valyala/gozstd@${GOZSTD_VER}; if [[ ! -f _rebuilt ]]; then chmod -R +w .; make -j8 clean; make -j8 libzstd.a; touch _rebuilt; fi;
+
 ADD . .
 RUN make all