aboutsummaryrefslogtreecommitdiff
path: root/src/ruby
diff options
context:
space:
mode:
authoreitsupi <50911393+eitsupi@users.noreply.github.com>2022-10-11 01:33:01 +0300
committerGitHub <noreply@github.com>2022-10-11 01:33:01 +0300
commita8cb375d460840bbf8c91599d16fc87d9ee8b996 (patch)
tree73dd647775325582c17a452816457f5cec82004d /src/ruby
parent065b5ec9e19d4f289a070c3d5337696fd2394dc0 (diff)
Ensure remove apt-update cache at the beginning and end of the scripts (#210)
* remove apt lists * bump versions
Diffstat (limited to 'src/ruby')
-rw-r--r--src/ruby/devcontainer-feature.json4
-rwxr-xr-xsrc/ruby/install.sh15
2 files changed, 13 insertions, 6 deletions
diff --git a/src/ruby/devcontainer-feature.json b/src/ruby/devcontainer-feature.json
index 9e617d0..e2d909f 100644
--- a/src/ruby/devcontainer-feature.json
+++ b/src/ruby/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "ruby",
- "version": "1.0.4",
+ "version": "1.0.5",
"name": "Ruby (via rvm)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
@@ -31,4 +31,4 @@
"MY_RUBY_HOME": "/usr/local/rvm/rubies/default",
"PATH": "/usr/local/rvm/gems/default/bin:/usr/local/rvm/gems/default@global/bin:/usr/local/rvm/rubies/default/bin:/usr/local/share/rbenv/bin:${PATH}"
}
-} \ No newline at end of file
+}
diff --git a/src/ruby/install.sh b/src/ruby/install.sh
index 6ff3b2f..2228522 100755
--- a/src/ruby/install.sh
+++ b/src/ruby/install.sh
@@ -28,6 +28,9 @@ keyserver hkp://keyserver.pgp.com"
set -e
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
@@ -154,8 +157,10 @@ find_version_from_git_tags() {
apt_get_update()
{
- echo "Running apt-get update..."
- apt-get update -y
+ if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+ echo "Running apt-get update..."
+ apt-get update -y
+ fi
}
# Checks if packages are installed and installs them if not
@@ -180,8 +185,7 @@ check_packages curl ca-certificates software-properties-common build-essential g
procps dirmngr gawk autoconf automake bison libffi-dev libgdbm-dev libncurses5-dev \
libsqlite3-dev libtool libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libssl-dev
if ! type git > /dev/null 2>&1; then
- apt_get_update
- apt-get -y install --no-install-recommends git
+ check_packages git
fi
@@ -301,4 +305,7 @@ find "/usr/local/rvm/" -type d | xargs -n 1 chmod g+s
rvm cleanup all
${ROOT_GEM} cleanup
+# Clean up
+rm -rf /var/lib/apt/lists/*
+
echo "Done!"