Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
ArgumentError: could not find a temporary directory
Hello,
I am trying to build a docker image for contributing to the devdocs repository, however I am failing to get past the thor docs:download --all
command. It fails with the below error:
. is world-writable: /devdocs
(1/680) Angular FAILED (ArgumentError: could not find a temporary directory)
Does anybody have an idea why this is occurring?
If it helps, the thor
command is using Ruby.
Below is my Dockerfile
:
#
# Base layer that both dev and runtime inherit from.
#
FROM ruby:3.3.2-alpine as devdocs-base
ENV LANG=C.UTF-8
ARG USERNAME=devdocs
ARG USER_ID=1000
ARG GROUP_ID=1000
WORKDIR /devdocs
EXPOSE 9292
COPY Gemfile Gemfile.lock Rakefile Thorfile /devdocs/
RUN apk --update add nodejs build-base libstdc++ gzip git zlib-dev libcurl && \
rm -rf /var/cache/apk/* /usr/lib/node_modules
RUN gem install bundler && \
bundle config set path.system true && \
bundle config set without test && \
bundle install && \
rm -rf ~/.gem /root/.bundle/cache /usr/local/bundle/cache /tmp
RUN addgroup -g $GROUP_ID $USERNAME && \
adduser -u $USER_ID -G $USERNAME -D -h /devdocs $USERNAME && \
chown -R $USERNAME:$USERNAME /devdocs
#
# Development Image
#
FROM devdocs-base as devdocs-dev
RUN bundle config unset without && \
bundle install && \
apk add --update bash curl && \
curl -LO https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz && \
tar -xzf docker-26.1.4.tgz && \
mv docker/docker /usr/bin && \
rm -rf docker docker-26.1.4.tgz /tmp && \
rm -rf ~/.gem /root/.bundle/cache /usr/local/bundle/cache
VOLUME [ "/devdocs" ]
CMD bash
#
# Runtime Image
#
FROM devdocs-base as devdocs
ENV ENABLE_SERVICE_WORKER=true
COPY . /devdocs/
RUN thor docs:download --all && \
thor assets:compile && \
apk del gzip build-base git zlib-dev && \
rm -rf /tmp
RUN chown -R $USERNAME:$USERNAME /devdocs
USER $USERNAME
CMD rackup --host 0.0.0.0 -E production
1 answer
The following users marked this post as Works for me:
User | Comment | Date |
---|---|---|
zmzaps | (no comment) | Jun 23, 2024 at 16:17 |
It turns out that within my Dockerfile
, the /tmp
directory was being deleted by a rm -rf /tmp
command. This resulted in the /tmp
directory being non-existent, leading to this error.
By removing the rm -rf /tmp
command from my Dockerfile
, the error went away.
1 comment thread