From 8afa901272b0184df2f3d609ce2ceb1f9c435eca Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 6 Sep 2023 14:27:23 +0200 Subject: [PATCH] pre-warm go --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index f4d46a8f1f..a6c2b55def 100644 --- a/Dockerfile +++ b/Dockerfile @@ -164,6 +164,9 @@ RUN set -eux; \ ENV PATH="${PATH}:/usr/local/go/bin" ENV GO_PATH=/usr/local/go/bin/go +# go build is slower the first time it is ran, so we prewarm it in the build +RUN mkdir -p /tmp/gobuildwarm && cd /tmp/gobuildwarm && go mod init gobuildwarm && printf "package foo\nimport (\"fmt\")\nfmt.Println(42)" > warm.go && go build -x && rm -rf /tmp/gobuildwarm + ENV TZ=Etc/UTC RUN /usr/local/bin/python3 -m pip install pip-tools