Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to cache in Docker #1924

Open
trajano opened this issue Oct 29, 2024 · 2 comments
Open

unable to cache in Docker #1924

trajano opened this issue Oct 29, 2024 · 2 comments

Comments

@trajano
Copy link

trajano commented Oct 29, 2024

I wanted to do some extra caching of volta binaries

FROM --platform=$BUILDPLATFORM eclipse-temurin:21-jdk AS volta
USER ubuntu
ENV VOLTA_HOME=/home/ubuntu/.volta
ENV PATH=$VOLTA_HOME/bin:$PATH
WORKDIR /home/ubuntu/.volta
RUN --mount=type=cache,target=/home/ubuntu/.volta/cache,uid=1000,gid=1000 \
    --mount=type=cache,target=/home/ubuntu/.volta/tools,uid=1000,gid=1000 \
    whoami && \ 
    ls -laR $HOME/ && \
    touch /home/ubuntu/.volta/cache/node/foo.txt &&\
    touch /home/ubuntu/.volta/cache/node/index.json &&\
  curl https://get.volta.sh | bash \
  && volta install node@latest npm@latest \

whoami returns correctly as ubuntu
the touch commands work
but the curl does this

Installing latest version of Volta (2.0.1)
Checking for existing Volta installation
Fetching archive for Linux, version 2.0.1
#=#=###O#-#0.1%#############18.7%########################## 37.0%######################################### 57.7%######################################################## 78.3%###################################################################### 98.5%######################################################################## 100.0%
Creating directory layout
Extracting Volta binaries and launchers
Finished installation. Updating user profile settings.
error: Could not write Node index cache
to /home/ubuntu/.volta/cache/node/index.json

The permissions appear to be correct

/home/ubuntu/.volta/cache/node:
total 8
drwxr-xr-x 2 ubuntu ubuntu 4096 Oct 29 14:27 .
drwxr-xr-x 1 ubuntu ubuntu 4096 Oct 29 14:20 ..
-rw-r--r-- 1 ubuntu ubuntu 0 Oct 29 14:27 foo.txt
-rw-r--r-- 1 ubuntu ubuntu 0 Oct 29 14:27 index.json
@trajano
Copy link
Author

trajano commented Oct 29, 2024

I have also tried

RUN --mount=type=cache,target=/home/ubuntu/.volta/cache,uid=1000,gid=1000
--mount=type=cache,target=/home/ubuntu/.volta/tools,uid=1000,gid=1000
--mount=type=tmpfs,target=/home/ubuntu/.volta/tmp \

@trajano
Copy link
Author

trajano commented Oct 29, 2024

With just this it also fails

RUN --mount=type=tmpfs,target=/home/ubuntu/.volta/tmp \
  curl https://get.volta.sh | bash \
  && volta install node@latest npm@latest \

So I suspect it's something to do with the staging and temp directory related code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant