cache bundle install at devcontainer build step

This commit is contained in:
Dylan Knutson
2025-07-20 18:24:51 +00:00
parent 8854dddb4a
commit 3a8d71e2f7
20 changed files with 3114 additions and 39 deletions

View File

@@ -19,5 +19,15 @@ RUN git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ru
RUN rbenv install 3.4.4 && \
rbenv global 3.4.4
# cache bundle install to make reloading the devcontainer faster
RUN mkdir -p /tmp/bundle-install-cache && \
chown -R vscode:vscode /tmp/bundle-install-cache
WORKDIR /tmp/bundle-install-cache
COPY lib/has_aux_table/version.rb /tmp/bundle-install-cache/lib/has_aux_table/version.rb
COPY Gemfile.lock Gemfile has-aux-table.gemspec /tmp/bundle-install-cache/
RUN BUNDLE_FROZEN=true MAKE="make -j$(nproc)" bundle install --jobs $(nproc)
# convenience aliases
RUN echo 'alias rspec="bundle exec rspec"' >> ~/.bashrc
RUN echo 'alias tapioca="bundle exec tapioca"' >> ~/.bashrc
RUN echo 'alias srb="bundle exec srb"' >> ~/.bashrc

View File

@@ -4,7 +4,8 @@
"name": "Ruby",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile"
"dockerfile": "Dockerfile",
"context": ".."
},
"features": {
"ghcr.io/devcontainers-extra/features/npm-package:1": {
@@ -18,10 +19,11 @@
"aliariff.vscode-erb-beautify",
"KoichiSasada.vscode-rdbg",
"qwtel.sqlite-viewer",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters"
]
}
},
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.