From ca027c26f64b3270c65b624f5d34592ae3b9c594 Mon Sep 17 00:00:00 2001 From: Marino Bonetti Date: Tue, 12 Mar 2024 06:57:07 +0100 Subject: [PATCH] user and group defined in alias and change permits for bundle (#15) * user and group defined in alias and change permits for bundle * configuring it as ENV it's not user specific --- Dockerfile | 4 +++- README.md | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5407971..aa20403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,10 @@ RUN apt-get update -qq && apt-get install -y nodejs && npm install -g yarn WORKDIR /rails # Ensure gems are installed on a persistent volume and available as bins +# Make the folder world writable to let the default user install the gems +RUN mkdir /bundle && chmod -R ugo+rwt /bundle VOLUME /bundle -RUN bundle config set --global path '/bundle' +ENV BUNDLE_PATH='/bundle' ENV PATH="/bundle/ruby/$RUBY_VERSION/bin:${PATH}" # Install Rails diff --git a/README.md b/README.md index ad8bd5a..5bc2d40 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Install [Docker](https://www.docker.com/products/docker-desktop/) (and [WSL](htt ```bash docker volume create ruby-bundle-cache -alias docked='docker run --rm -it -v ${PWD}:/rails -v ruby-bundle-cache:/bundle -p 3000:3000 ghcr.io/rails/cli' +alias docked='docker run --rm -it -v ${PWD}:/rails -u $(id -u):$(id -g) -v ruby-bundle-cache:/bundle -p 3000:3000 ghcr.io/rails/cli' ``` Then create your Rails app: