floryn90 / docker-hugo

Truly minimal Docker images for Hugo open-source static site generator.
https://hub.docker.com/r/floryn90/hugo
MIT License
38 stars 3 forks source link

Issues with Yarn permissions #168

Closed tobru closed 2 days ago

tobru commented 1 week ago

Given the following Dockerfile:

### BUILDER
FROM docker.io/floryn90/hugo:0.137.1-ext-alpine-ci AS hugo

WORKDIR /src
ADD . /src
RUN yarn install && hugo -d /target

### RUNTIME
FROM docker.io/nginx AS runtime
COPY --from=hugo /target /usr/share/nginx/html

Yields into:

[1/2] STEP 1/4: FROM docker.io/floryn90/hugo:0.137.1-ext-alpine-ci AS hugo
[1/2] STEP 2/4: WORKDIR /src
--> Using cache 2d49e8d98a3c71d288652db7e51866481cad45a806baa106b007c56d292fd0e2
--> 2d49e8d98a3c
[1/2] STEP 3/4: ADD . /src
--> 814c372cf87e
[1/2] STEP 4/4: RUN yarn install && hugo -d /target
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 3.07s.
Start building sites … 
hugo v0.137.1-17e15b2148cee6da923acd7adf2ec31ea6b3415c+extended linux/amd64 BuildDate=2024-11-05T11:49:09Z VendorInfo=gohugoio

Total in 28 ms
Error: error building site: failed to acquire a build lock: open /src/.hugo_build.lock: permission denied
Error: building at STEP "RUN yarn install && hugo -d /target": while running runtime: exit status 1

This used to work with 0.131.0 (I'm currently upgrading...)

rojomisin commented 6 days ago

similar

WARN  deprecated: resources.ToCSS was deprecated in Hugo v0.128.0 and will be removed in a future release. Use css.Sass instead.
WARN  Failed to write jsconfig.json: open /src/assets/jsconfig.json: permission denied
Total in 1733 ms
Error: error building site: mkdir /src/resources/_gen/assets/sass: permission denied
The command '/bin/sh -c if [ -e "$ONBUILD_SCRIPT_VALUE" ]; then exec sh $ONBUILD_SCRIPT_VALUE; else exec hugo $HUGO_CMD; fi' returned a non-zero code: 1
floryn90 commented 2 days ago

Solved with #172