Ensure remove apt-update cache at the beginning and end of the scripts (#210)

* remove apt lists

* bump versions
This commit is contained in:
eitsupi 2022-10-11 07:33:01 +09:00 committed by GitHub
parent 065b5ec9e1
commit a8cb375d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 352 additions and 130 deletions

View file

@ -1,6 +1,6 @@
{
"id": "anaconda",
"version": "1.0.7",
"version": "1.0.8",
"name": "Anaconda",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/anaconda",
"options": {

View file

@ -16,6 +16,9 @@ CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"}
set -eux
export DEBIAN_FRONTEND=noninteractive
# 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
@ -64,7 +67,10 @@ updaterc() {
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
fi
}
@ -128,4 +134,7 @@ if [ -f "/etc/bash.bashrc" ]; then
echo "${notice_script}" | tee -a /etc/bash.bashrc
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "aws-cli",
"version": "1.0.3",
"version": "1.0.4",
"name": "AWS CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/aws-cli",
"description": "Installs the AWS CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
VERSION=${VERSION:-"latest"}
AWSCLI_GPG_KEY=FB5DB77FD5C118B80511ADA8A6310ACC4672475C
@ -71,7 +74,10 @@ apt_get_update()
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
fi
}
@ -133,4 +139,7 @@ echo "(*) Installing AWS CLI..."
install
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "azure-cli",
"version": "1.0.3",
"version": "1.0.4",
"name": "Azure CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/azure-cli",
"description": "Installs the Azure CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
AZ_VERSION=${VERSION:-"latest"}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
@ -44,7 +47,10 @@ apt_get_update()
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
fi
}
@ -179,4 +185,7 @@ if [ "${use_pip}" = "true" ]; then
fi
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "common-utils",
"version": "1.1.2",
"version": "1.1.3",
"name": "Common Debian Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
INSTALL_ZSH=${INSTALLZSH:-"true"}
INSTALL_OH_MY_ZSH=${INSTALLOHMYZSH:-"true"}
UPGRADE_PACKAGES=${UPGRADEPACKAGES:-"true"}
@ -60,8 +63,10 @@ export DEBIAN_FRONTEND=noninteractive
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
# Run install apt-utils to avoid debconf warning then verify presence of other common developer tools and dependencies
@ -447,4 +452,7 @@ echo -e "\
RC_SNIPPET_ALREADY_ADDED=${RC_SNIPPET_ALREADY_ADDED}\n\
ZSH_ALREADY_INSTALLED=${ZSH_ALREADY_INSTALLED}" > "${MARKER_FILE}"
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "conda",
"version": "1.0.3",
"version": "1.0.4",
"name": "Conda",
"description": "A cross-platform, language-agnostic binary package manager",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/conda",

View file

@ -14,6 +14,9 @@ CONDA_DIR="/opt/conda"
set -eux
export DEBIAN_FRONTEND=noninteractive
# 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
@ -50,12 +53,11 @@ fi
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
# Clean up
apt-get clean -y
rm -rf /var/lib/apt/lists/*
fi
}
@ -73,6 +75,7 @@ if ! conda --version &> /dev/null ; then
curl -sS https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > /usr/share/keyrings/conda-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/conda-archive-keyring.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" > /etc/apt/sources.list.d/conda.list
apt-get update -y
CONDA_PKG="conda=${VERSION}-0"
if [ "${VERSION}" = "latest" ]; then
@ -123,4 +126,7 @@ if [ -f "/etc/bash.bashrc" ]; then
echo "${notice_script}" | tee -a /etc/bash.bashrc
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "desktop-lite",
"version": "1.0.3",
"version": "1.0.4",
"name": "Light-weight Desktop",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite",
"description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.",

View file

@ -63,6 +63,9 @@ package_list_additional="
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
@ -151,8 +154,10 @@ copy_fluxbox_config() {
apt_get_update()
{
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
@ -176,7 +181,7 @@ apt_get_update
if [[ -z $(apt-cache --names-only search ^tilix$) ]]; then
. /etc/os-release
if [ "${ID}" = "ubuntu" ]; then
apt-get install -y --no-install-recommends apt-transport-https software-properties-common
check_packages apt-transport-https software-properties-common
add-apt-repository -y ppa:webupd8team/terminix
elif [ "${VERSION_CODENAME}" = "stretch" ]; then
echo "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list
@ -232,9 +237,7 @@ if [ "${INSTALL_NOVNC}" = "true" ] && [ ! -d "/usr/local/novnc" ]; then
rm -f /tmp/websockify-install.zip /tmp/novnc-install.zip
# Install noVNC dependencies and use them.
if ! dpkg -s python3-minimal python3-numpy > /dev/null 2>&1; then
apt-get -y install --no-install-recommends python3-minimal python3-numpy
fi
check_packages python3-minimal python3-numpy
sed -i -E 's/^python /python3 /' /usr/local/novnc/websockify-${WEBSOCKETIFY_VERSION}/run
fi
@ -387,6 +390,9 @@ if [ "${USERNAME}" != "root" ]; then
chown -R ${USERNAME} /home/${USERNAME}/.Xmodmap /home/${USERNAME}/.fluxbox
fi
# Clean up
rm -rf /var/lib/apt/lists/*
cat << EOF

View file

@ -1,6 +1,6 @@
{
"id": "docker-from-docker",
"version": "1.0.4",
"version": "1.0.5",
"name": "Docker (Docker-from-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-from-docker",
"descripton": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",

View file

@ -22,6 +22,9 @@ DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute
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
@ -61,8 +64,10 @@ get_common_setting() {
apt_get_update()
{
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
@ -113,8 +118,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install git
check_packages git
fi
# Source /etc/os-release to get OS info
@ -206,10 +210,7 @@ else
fi
if [ "${TARGET_COMPOSE_ARCH}" != "x86_64" ]; then
# Use pip to get a version that runns on this architecture
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
apt_get_update
apt-get -y install python3-minimal python3-pip libffi-dev python3-venv
fi
check_packages python3-minimal python3-pip libffi-dev python3-venv
export PIPX_HOME=/usr/local/pipx
mkdir -p ${PIPX_HOME}
export PIPX_BIN_DIR=/usr/local/bin
@ -255,6 +256,8 @@ fi
# If init file already exists, exit
if [ -f "/usr/local/share/docker-init.sh" ]; then
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
echo "docker-init doesnt exist, adding..."
@ -269,6 +272,8 @@ fi
if [ "${ENABLE_NONROOT_DOCKER}" = "false" ] || [ "${USERNAME}" = "root" ]; then
echo -e '#!/usr/bin/env bash\nexec "$@"' > /usr/local/share/docker-init.sh
chmod +x /usr/local/share/docker-init.sh
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
@ -281,10 +286,7 @@ DOCKER_GID="$(grep -oP '^docker:x:\K[^:]+' /etc/group)"
# If enabling non-root access and specified user is found, setup socat and add script
chown -h "${USERNAME}":root "${TARGET_SOCKET}"
if ! dpkg -s socat > /dev/null 2>&1; then
apt_get_update
apt-get -y install socat
fi
check_packages socat
tee /usr/local/share/docker-init.sh > /dev/null \
<< EOF
#!/usr/bin/env bash
@ -346,4 +348,8 @@ exec "\$@"
EOF
chmod +x /usr/local/share/docker-init.sh
chown ${USERNAME}:root /usr/local/share/docker-init.sh
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "docker-in-docker",
"version": "1.0.5",
"version": "1.0.6",
"name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",

View file

@ -23,6 +23,9 @@ DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute
# Default: Exit on any failure.
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
# Setup STDERR.
err() {
echo "(!) $*" >&2
@ -72,8 +75,10 @@ get_common_setting() {
apt_get_update()
{
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
@ -154,8 +159,7 @@ fi
# Install dependencies
check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install git
check_packages git
fi
# Swap to legacy iptables for compatibility
@ -249,10 +253,7 @@ else
fi
if [ "${target_compose_arch}" != "x86_64" ]; then
# Use pip to get a version that runs on this architecture
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
apt_get_update
apt-get -y install python3-minimal python3-pip libffi-dev python3-venv
fi
check_packages python3-minimal python3-pip libffi-dev python3-venv
export PIPX_HOME=/usr/local/pipx
mkdir -p ${PIPX_HOME}
export PIPX_BIN_DIR=/usr/local/bin
@ -299,6 +300,8 @@ fi
# If init file already exists, exit
if [ -f "/usr/local/share/docker-init.sh" ]; then
echo "/usr/local/share/docker-init.sh already exists, so exiting."
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
echo "docker-init doesnt exist, adding..."
@ -398,4 +401,7 @@ EOF
chmod +x /usr/local/share/docker-init.sh
chown ${USERNAME}:root /usr/local/share/docker-init.sh
# Clean up
rm -rf /var/lib/apt/lists/*
echo 'docker-in-docker-debian script has completed!'

View file

@ -1,6 +1,6 @@
{
"id": "dotnet",
"version": "1.0.6",
"version": "1.0.7",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.",

View file

@ -30,6 +30,11 @@ DOTNET_VERSION_CODENAMES_REQUIRE_OLDER_LIBSSL_1="buster bullseye bionic focal hi
# alongside DOTNET_VERSION, but not set as default.
ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""}
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
# Setup STDERR.
err() {
echo "(!) $*" >&2
@ -109,8 +114,10 @@ updaterc() {
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
# Check if packages are installed and installs them if not.
@ -463,4 +470,7 @@ if [ "${CHANGE_OWNERSHIP}" = "true" ]; then
find "${TARGET_DOTNET_ROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "git-lfs",
"version": "1.0.2",
"version": "1.0.3",
"name": "Git Large File Support (LFS)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git-lfs",
"description": "Installs Git Large File Support (Git LFS) along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like git and curl.",

View file

@ -19,6 +19,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
@ -107,8 +110,10 @@ receive_gpg_keys() {
apt_get_update()
{
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
@ -178,8 +183,7 @@ export DEBIAN_FRONTEND=noninteractive
. /etc/os-release
check_packages curl ca-certificates gnupg2 dirmngr apt-transport-https
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
if [ "${ID}" = "debian" ]; then
check_packages debian-archive-keyring
@ -199,4 +203,7 @@ if [ "${use_github}" = "true" ]; then
install_using_github
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "git",
"version": "1.0.3",
"version": "1.0.4",
"name": "Git (from source)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git",
"description": "Install an up-to-date version of Git, built from source as needed. Useful for when you want the latest and greatest features. Auto-detects latest stable version and installs needed dependencies.",

View file

@ -17,6 +17,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
@ -76,8 +79,10 @@ receive_gpg_keys() {
apt_get_update()
{
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
@ -97,11 +102,15 @@ export DEBIAN_FRONTEND=noninteractive
if [ ${GIT_VERSION} = "os-provided" ] || [ ${GIT_VERSION} = "system" ]; then
if type git > /dev/null 2>&1; then
echo "Detected existing system install: $(git version)"
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
echo "Installing git from OS apt repository"
check_packages git
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
@ -114,6 +123,7 @@ if ([ "${GIT_VERSION}" = "latest" ] || [ "${GIT_VERSION}" = "lts" ] || [ "${GIT_
apt-get update
apt-get -y install --no-install-recommends git
rm -rf "/tmp/tmp-gnupg"
rm -rf /var/lib/apt/lists/*
exit 0
fi
@ -143,4 +153,5 @@ echo "Building..."
cd /tmp/git-${GIT_VERSION}
make -s prefix=/usr/local all && make -s prefix=/usr/local install 2>&1
rm -rf /tmp/git-${GIT_VERSION}
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "github-cli",
"version": "1.0.4",
"version": "1.0.5",
"name": "GitHub CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli",
"description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.",

View file

@ -17,6 +17,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
@ -141,8 +144,10 @@ receive_gpg_keys() {
apt_get_update()
{
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
@ -209,8 +214,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install curl, apt-transport-https, curl, gpg, or dirmngr, git if missing
check_packages curl ca-certificates apt-transport-https dirmngr gnupg2
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
# Soft version matching
@ -236,3 +240,6 @@ else
rm -rf "/tmp/gh/gnupg"
echo "Done!"
fi
# Clean up
rm -rf /var/lib/apt/lists/*

View file

@ -1,6 +1,6 @@
{
"id": "go",
"version": "1.0.7",
"version": "1.0.8",
"name": "Go",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/go",
"description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.",

View file

@ -19,6 +19,9 @@ GO_GPG_KEY_URI="https://dl.google.com/linux/linux_signing_key.pub"
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
@ -97,8 +100,10 @@ get_common_setting() {
apt_get_update()
{
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
@ -114,8 +119,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install curl, tar, git, other dependencies if missing
check_packages curl ca-certificates gnupg2 tar g++ gcc libc6-dev make pkg-config
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
# Get closest match for version number specified
@ -225,4 +229,7 @@ chmod -R g+r+w "${TARGET_GOROOT}" "${TARGET_GOPATH}"
find "${TARGET_GOROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
find "${TARGET_GOPATH}" -type d -print0 | xargs -n 1 -0 chmod g+s
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "hugo",
"version": "1.0.4",
"version": "1.0.5",
"name": "Hugo",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/hugo",
"options": {

View file

@ -16,6 +16,9 @@ HUGO_DIR=${HUGO_DIR:-"/usr/local/hugo"}
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
@ -63,8 +66,10 @@ updaterc() {
apt_get_update()
{
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
@ -114,4 +119,7 @@ if ! hugo version &> /dev/null ; then
find "${HUGO_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "java",
"version": "1.0.9",
"version": "1.0.10",
"name": "Java (via SDKMAN!)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",

View file

@ -24,6 +24,9 @@ ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""}
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
@ -65,8 +68,10 @@ updaterc() {
apt_get_update()
{
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
@ -176,4 +181,7 @@ if [[ "${INSTALL_MAVEN}" = "true" ]] && ! mvn --version > /dev/null; then
sdk_install maven latest
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "kubectl-helm-minikube",
"version": "1.0.3",
"version": "1.0.4",
"name": "Kubectl, Helm, and Minkube",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube",
"description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
KUBECTL_VERSION="${VERSION:-"latest"}"
HELM_VERSION="${HELM:-"latest"}"
MINIKUBE_VERSION="${MINIKUBE:-"none"}" # latest is also valid
@ -102,8 +105,10 @@ find_version_from_git_tags() {
apt_get_update()
{
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
@ -120,8 +125,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies
check_packages curl ca-certificates coreutils gnupg2 dirmngr bash-completion
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
architecture="$(uname -m)"
@ -240,4 +244,7 @@ if ! type docker > /dev/null 2>&1; then
echo -e '\n(*) Warning: The docker command was not found.\n\nYou can use one of the following scripts to install it:\n\nhttps://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md\n\nor\n\nhttps://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker.md'
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo -e "\nDone!"

View file

@ -1,6 +1,6 @@
{
"id": "node",
"version": "1.0.6",
"version": "1.0.7",
"name": "Node.js (via nvm) and yarn",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
"description": "Installs Node.js, nvm, yarn, and needed dependencies.",

View file

@ -22,6 +22,9 @@ export NVM_VERSION="0.38.0"
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
@ -62,8 +65,10 @@ updaterc() {
}
apt_get_update() {
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
@ -109,6 +114,8 @@ if [ -d "${NVM_DIR}" ]; then
if [ "${NODE_VERSION}" != "" ]; then
su ${USERNAME} -c ". $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm clear-cache"
fi
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
@ -187,4 +194,7 @@ fi
find "${NVM_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "nvidia-cuda",
"version": "1.0.2",
"version": "1.0.3",
"name": "NVIDIA CUDA",
"description": "Installs shared libraries for NVIDIA CUDA.",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/nvidia-cuda",

View file

@ -2,6 +2,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
INSTALL_CUDNN=${INSTALLCUDNN}
INSTALL_NVTX=${INSTALLNVTX}
CUDA_VERSION=${CUDAVERSION}
@ -12,9 +15,23 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Install dependencies
apt-get update -yq
apt-get install -yq wget ca-certificates
apt_get_update()
{
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
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
check_packages wget ca-certificates
# Add NVIDIA's package repository to apt so that we can download packages
# Always use the ubuntu2004 repo because the other repos (e.g., debian11) are missing packages
@ -55,4 +72,7 @@ if [ "$INSTALL_NVTX" = "true" ]; then
apt-get install -yq "$nvtx_pkg"
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "oryx",
"version": "1.0.6",
"version": "1.0.7",
"name": "Oryx",
"description": "Installs the oryx CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx",

View file

@ -12,6 +12,9 @@ MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
set -eu
# 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
@ -53,19 +56,17 @@ function updaterc() {
apt_get_update()
{
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
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends "$@"
# Clean up
apt-get clean -y
rm -rf /var/lib/apt/lists/*
apt-get -y install --no-install-recommends "$@"
fi
}
@ -105,6 +106,8 @@ fi
# If we don't already have Oryx installed, install it now.
if oryx --version > /dev/null ; then
echo "oryx is already installed. Skipping installation."
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
@ -182,4 +185,7 @@ if [[ "${DOTNET_INSTALLATION_PACKAGE}" != "" ]]; then
apt purge -yq $DOTNET_INSTALLATION_PACKAGE
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "php",
"version": "1.0.6",
"version": "1.0.7",
"name": "PHP",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/php",
"options": {

View file

@ -8,6 +8,9 @@
set -eux
# Clean up
rm -rf /var/lib/apt/lists/*
VERSION=${VERSION:-"latest"}
INSTALL_COMPOSER=${INSTALLCOMPOSER:-"true"}
OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"}
@ -73,7 +76,10 @@ updaterc() {
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt-get update
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends "$@"
fi
}
@ -222,4 +228,7 @@ chown -R "${USERNAME}:php" "${PHP_DIR}"
chmod -R g+r+w "${PHP_DIR}"
find "${PHP_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "powershell",
"version": "1.0.2",
"version": "1.0.3",
"name": "PowerShell",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/powershell",
"description": "Installs PowerShell along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
POWERSHELL_VERSION=${VERSION:-"latest"}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
@ -74,8 +77,10 @@ get_common_setting() {
apt_get_update()
{
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
@ -118,8 +123,7 @@ install_using_github() {
# Fall back on direct download if no apt package exists in microsoft pool
check_packages curl ca-certificates gnupg2 dirmngr libc6 libgcc1 libgssapi-krb5-2 libstdc++6 libunwind8 libuuid1 zlib1g libicu[0-9][0-9]
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get install -y --no-install-recommends git
check_packages git
fi
if [ "${architecture}" = "amd64" ]; then
architecture="x64"
@ -161,4 +165,7 @@ if [ "${use_github}" = "true" ]; then
install_using_github
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "python",
"version": "1.0.8",
"version": "1.0.9",
"name": "Python",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",

View file

@ -34,6 +34,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
@ -199,8 +202,10 @@ oryx_install() {
apt_get_update()
{
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
@ -232,8 +237,7 @@ install_from_source() {
libbz2-dev libreadline-dev libxml2-dev xz-utils libgdbm-dev tk-dev dirmngr \
libxmlsec1-dev libsqlite3-dev libffi-dev liblzma-dev uuid-dev
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
# Find version using soft match
@ -454,4 +458,7 @@ if [ "${INSTALL_JUPYTERLAB}" = "true" ]; then
fi
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -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.",

View file

@ -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()
{
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!"

View file

@ -1,6 +1,6 @@
{
"id": "rust",
"version": "1.0.6",
"version": "1.0.7",
"name": "Rust",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/rust",
"description": "Installs Rust, common Rust utilities, and their required dependencies",

View file

@ -18,6 +18,9 @@ UPDATE_RUST=${UPDATE_RUST:-"false"}
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
@ -127,8 +130,18 @@ updaterc() {
apt_get_update()
{
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
check_packages() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
export DEBIAN_FRONTEND=noninteractive
@ -170,8 +183,7 @@ else
if [ "${RUST_VERSION}" != "latest" ] && [ "${RUST_VERSION}" != "lts" ] && [ "${RUST_VERSION}" != "stable" ]; then
# Find version using soft match
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
is_nightly=0
@ -215,5 +227,8 @@ EOF
# Make files writable for rustlang group
chmod -R g+r+w "${RUSTUP_HOME}" "${CARGO_HOME}"
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"

View file

@ -1,6 +1,6 @@
{
"id": "sshd",
"version": "1.0.3",
"version": "1.0.4",
"name": "SSH server",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/sshd",
"description": "Adds a SSH server into a container so that you can use an external terminal, sftp, or SSHFS to interact with it.",

View file

@ -17,6 +17,9 @@ FIX_ENVIRONMENT=${FIX_ENVIRONMENT:-"true"}
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
@ -41,8 +44,10 @@ fi
apt_get_update()
{
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
@ -166,4 +171,8 @@ echo -e "Done!\n\n- Port: ${SSHD_PORT}\n- User: ${USERNAME}"
if [ "${EMIT_PASSWORD}" = "true" ]; then
echo "- Password: ${NEW_PASSWORD}"
fi
# Clean up
rm -rf /var/lib/apt/lists/*
echo -e "\nForward port ${SSHD_PORT} to your local machine and run:\n\n ssh -p ${SSHD_PORT} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null ${USERNAME}@localhost\n"

View file

@ -1,6 +1,6 @@
{
"id": "terraform",
"version": "1.0.5",
"version": "1.0.6",
"name": "Terraform, tflint, and TFGrunt",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/terraform",
"description": "Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies.",

View file

@ -9,6 +9,9 @@
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
TERRAFORM_VERSION="${VERSION:-"latest"}"
TFLINT_VERSION="${TFLINT:-"latest"}"
TERRAGRUNT_VERSION="${TERRAGRUNT:-"latest"}"
@ -124,8 +127,10 @@ find_version_from_git_tags() {
apt_get_update()
{
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
@ -142,8 +147,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies if missing
check_packages curl ca-certificates gnupg2 dirmngr coreutils unzip
if ! type git > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends git
check_packages git
fi
# Verify requested version is available, convert latest
@ -209,4 +213,8 @@ if [ "${TERRAGRUNT_VERSION}" != "none" ]; then
fi
rm -rf /tmp/tf-downloads ${GNUPGHOME}
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"