Improve cache, temp location cleanup

This commit is contained in:
Chuck Lantz 2020-08-23 20:27:13 -07:00
Родитель 6ca4f8c088
Коммит b0424b86f0
18 изменённых файлов: 30 добавлений и 27 удалений

Просмотреть файл

@ -10,8 +10,7 @@ ARG USER_GID=$USER_UID
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apk update \
&& /bin/ash /tmp/library-scripts/common-alpine.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" \
RUN apk update && ash /tmp/library-scripts/common-alpine.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" \
&& rm -rf /tmp/library-scripts
# ** [Optional] Uncomment this section to install additional packages. **

Просмотреть файл

@ -11,8 +11,7 @@ ARG USER_GID=$USER_UID
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apt-get update \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
RUN bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.

Просмотреть файл

@ -10,7 +10,7 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/shar
ARG INSTALL_AZURE_CLI="false"
COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

Просмотреть файл

@ -12,7 +12,7 @@ ARG USER_GID=$USER_UID
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/common-debian.sh /tmp/library-scripts/
RUN bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Install Node.js for use with web applications - update the INSTALL_NODE arg in devcontainer.json to enable.
ARG INSTALL_NODE="true"
@ -22,13 +22,13 @@ ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/node-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_NODE" = "true" ]; then bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Install the Azure CLI - update the INSTALL_AZURE_CLI arg in devcontainer.json to enable.
ARG INSTALL_AZURE_CLI="false"
COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

Просмотреть файл

@ -39,6 +39,7 @@ ARG GO_TOOLS_WITH_MODULES="\
RUN mkdir -p /tmp/gotools \
&& cd /tmp/gotools \
&& export GOPATH=/tmp/gotools \
&& export GOCACHE=/tmp/gotools/cache \
# Go tools w/module support
&& export GO111MODULE=on \
&& (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -x )2>&1 \
@ -63,7 +64,7 @@ ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/node-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_NODE" = "true" ]; then bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x <your-dependency-or-tool>

Просмотреть файл

@ -12,13 +12,14 @@ ARG USER_GID=$USER_UID
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/common-debian.sh /tmp/library-scripts/
RUN apt-get update && bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# Install xdebug
RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini
&& echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& rm -rf /tmp/pear
# Install composer
RUN curl -sSL https://getcomposer.org/installer | php \
@ -33,7 +34,7 @@ ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/node-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_NODE" = "true" ]; then /bin/bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

Просмотреть файл

@ -36,6 +36,7 @@ ENV PIPX_BIN_DIR=${PIPX_HOME}/bin
ENV PATH=${PATH}:${PIPX_BIN_DIR}
RUN mkdir -p ${PIPX_BIN_DIR} \
&& export PYTHONUSERBASE=/tmp/pip-tmp \
&& export PIP_CACHE_DIR=/tmp/pip-tmp/cache \
&& pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx \
&& /tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx \
&& echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args=--no-cache-dir --pip-args=--force-reinstall \

Просмотреть файл

@ -17,7 +17,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Install common packages, non-root user, core build tools
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get install -y build-essential \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/library-scripts
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# Install Ruby tools
RUN gem install rake ruby-debug-ide debase
@ -30,7 +30,7 @@ ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
COPY library-scripts/node-debian.sh /tmp/library-scripts/
RUN if [ "$INSTALL_NODE" = "true" ]; then /bin/bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

Просмотреть файл

@ -15,7 +15,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Install common packages, non-root user, updated lldb, dependencies
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get install -y lldb python3-minimal libpython3.7 \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# Install Rust components
RUN rustup update 2>&1 \

Просмотреть файл

@ -11,9 +11,8 @@ ARG USER_GID=$USER_UID
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
COPY library-scripts/*.sh /tmp/library-scripts/
RUN apt-get update \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
RUN bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

Просмотреть файл

@ -82,6 +82,7 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
mkdir -p /tmp/gotools
cd /tmp/gotools
export GOPATH=/tmp/gotools
export GOCACHE=/tmp/gotools/cache
# Go tools w/module support
export GO111MODULE=on

Просмотреть файл

@ -57,6 +57,6 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
fi
# Install gradle
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION}"
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
updaterc "export GRADLER_USER_HOME=\${HOME}/.gradle"
echo "Done!"

Просмотреть файл

@ -53,7 +53,7 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
fi
if [ "${JAVA_VERSION}" != "none" ]; then
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION}"
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
fi
echo "Done!"

Просмотреть файл

@ -57,6 +57,6 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
fi
# Install Maven
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION}"
su ${USERNAME} -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
updaterc "export M2=\$HOME/.m2"
echo "Done!"

Просмотреть файл

@ -51,7 +51,7 @@ fi
if [ -d "${NVM_DIR}" ]; then
echo "NVM already installed."
if [ "${NODE_VERSION}" != "" ]; then
su ${USERNAME} -c "nvm install ${NODE_VERSION}"
su ${USERNAME} -c "source $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm clear-cache"
fi
exit 0
fi
@ -80,10 +80,11 @@ fi
su ${USERNAME} -c "$(cat << EOF
set -e
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ${NVM_DIR}/nvm.sh
if [ "${NODE_VERSION}" != "" ]; then
source $NVM_DIR/nvm.sh
nvm alias default ${NODE_VERSION}
fi
nvm clear-cache
EOF
)" 2>&1

Просмотреть файл

@ -104,6 +104,7 @@ su ${USERNAME} -c "$(cat << EOF
export PIPX_HOME=${PIPX_HOME}
export PIPX_BIN_DIR=${PIPX_BIN_DIR}
export PYTHONUSERBASE=/tmp/pip-tmp
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
export PATH=${PATH}
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx

Просмотреть файл

@ -35,7 +35,7 @@ fi
# Just install Ruby if RVM already installed
if [ -d "/usr/local/rvm" ]; then
echo "Ruby Version Manager already exists. Installing specified Ruby version."
su ${USERNAME} -c "source /usr/local/rvm/scripts/rvm && rvm install ${RUBY_VERSION}"
su ${USERNAME} -c "source /usr/local/rvm/scripts/rvm && rvm install ${RUBY_VERSION} && rvm cleanup all"
exit 0
fi
@ -48,8 +48,8 @@ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703
# Install RVM
curl -sSL https://get.rvm.io | bash -s "${RUBY_VERSION}" --ruby --with-default-gems="rake ruby-debug-ide debase" 2>&1
usermod -aG rvm ${USERNAME}
su ${USERNAME} -c "source /usr/local/rvm/scripts/rvm && rvm fix-permissions system"
rm -rf ${GNUPGHOME} \
su ${USERNAME} -c "source /usr/local/rvm/scripts/rvm && rvm fix-permissions system && rvm cleanup all && gem cleanup"
rm -rf ${GNUPGHOME}
# Add sourcing of rvm into bashrc/zshrc files (unless disabled)
if [ "${UPDATE_RC}" = "true" ]; then

Просмотреть файл

@ -39,7 +39,7 @@ if ! type rustup > /dev/null 2>&1; then
echo "Installing Rust..."
mkdir -p "${CARGO_HOME}" "${RUSTUP_HOME}"
chown ${USERNAME}:root "${CARGO_HOME}" "${RUSTUP_HOME}"
su ${USERNAME} -c "curl --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path 2>&1"
su ${USERNAME} -c "curl --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path --profile minimal 2>&1"
else
echo "Rust already installed. Skipping."
fi