From 68437de9d4decabf6335e96037c74462224e14bc Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 28 Dec 2023 19:42:01 -0700 Subject: [PATCH] Run container as current user to avoid git issues https://github.com/klakegg/docker-hugo/issues/82 notes that root is the default user of the container, but that causes issues for our environment because it blocks git operations. Switch to run as the current user so that git operations are not blocked. Running as the current user means that the Hugo build lock cannot be written. Disable it with a command line switch. Not a perfect solution, but simple enough to allow upgrade to a more recent Hugo version. --- README.adoc | 2 +- docker-compose.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index f0c31275..ab975622 100644 --- a/README.adoc +++ b/README.adoc @@ -104,7 +104,7 @@ You can now execute the website locally: [source,bash] -- -docker compose up --build --force-recreate +RUN_AS_USER=$(id -u):$(id -g) docker compose up --build --force-recreate -- You can then access it at http://localhost:1313/. diff --git a/docker-compose.yaml b/docker-compose.yaml index 2b6f9038..fad75c0e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,10 @@ services: status: # "ext-" for the Hugo extended edition including git (https://github.com/floryn90/docker-hugo/blob/master/README.md#hugo-extended-edition) + user: ${RUN_AS_USER} image: floryn90/hugo:0.121.1-ext-asciidoctor volumes: - .:/src ports: - 1313:1313 - command: "server --cleanDestinationDir --disableFastRender --printPathWarnings --printMemoryUsage --logLevel info --noHTTPCache" + command: "server --cleanDestinationDir --disableFastRender --logLevel info --noBuildLock --printPathWarnings --printMemoryUsage --noHTTPCache"