Skip to content

Commit

Permalink
Run container as current user to avoid git issues
Browse files Browse the repository at this point in the history
klakegg/docker-hugo#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.
  • Loading branch information
MarkEWaite committed Dec 29, 2023
1 parent 7757086 commit 68437de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 68437de

Please sign in to comment.