Optimise build

This commit is contained in:
Andrew Ying 2024-11-18 11:15:06 +00:00
parent 6d8005f7a3
commit 86eec19ab6
Signed by: andrew
SSH key fingerprint: SHA256:6goOJXI6ckOipdsJS6oj5gbQYaRmCe37r7bSBnyQLyE

View file

@ -66,8 +66,7 @@ RUN apt-get update -y \
make \ make \
openssl \ openssl \
sudo \ sudo \
tklib \ tklib
vim
RUN groupadd --gid 1000 runner \ RUN groupadd --gid 1000 runner \
&& adduser --home /workspace --shell /bin/sh --uid 1000 --gid 1000 --disabled-password runner \ && adduser --home /workspace --shell /bin/sh --uid 1000 --gid 1000 --disabled-password runner \
@ -85,7 +84,7 @@ RUN mkdir -p /usr/share/keyrings \
&& echo "deb [signed-by=/usr/share/keyrings/git-core_ppa.gpg] https://ppa.launchpadcontent.net/git-core/ppa/ubuntu ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/git-core_ppa.list > /dev/null \ && echo "deb [signed-by=/usr/share/keyrings/git-core_ppa.gpg] https://ppa.launchpadcontent.net/git-core/ppa/ubuntu ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/git-core_ppa.list > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/github_git-lfs.gpg] https://packagecloud.io/github/git-lfs/ubuntu ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/github_git-lfs.list > /dev/null \ && echo "deb [signed-by=/usr/share/keyrings/github_git-lfs.gpg] https://packagecloud.io/github/git-lfs/ubuntu ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/github_git-lfs.list > /dev/null \
&& apt-get update -y \ && apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y \ && apt-get install --no-install-recommends --no-install-suggests \
git \ git \
git-lfs git-lfs
@ -95,8 +94,8 @@ RUN set -x \
&& chmod 0644 /usr/share/keyrings/nodesource.gpg \ && chmod 0644 /usr/share/keyrings/nodesource.gpg \
&& arch=$(dpkg --print-architecture) \ && arch=$(dpkg --print-architecture) \
&& echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION} nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null \ && echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION} nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null \
&& apt-get update -y \ && apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y nodejs \ && apt-get install --no-install-recommends --no-install-suggests nodejs \
&& npm update --global npm \ && npm update --global npm \
&& npm install --global yarn \ && npm install --global yarn \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash
@ -116,15 +115,29 @@ RUN set -x \
ansible \ ansible \
virtualenv virtualenv
RUN curl -sSL -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb \ RUN cd /tmp/build \
&& dpkg -i packages-microsoft-prod.deb \ && curl -OL https://aka.ms/downloadazcopy-v10-linux \
&& rm packages-microsoft-prod.deb \ && tar -xvzf downloadazcopy-v10-linux \
&& apt-get update -y \ && rm downloadazcopy-v10-linux \
&& apt-get install --no-install-recommends --no-install-suggests -y azcopy && cp -r azcopy_linux_amd64_*/azcopy /usr/local/bin/ \
&& rm -r azcopy_linux_amd64_* \
&& chmod 0755 /usr/local/bin/azcopy \
&& ln -s /usr/local/bin/azcopy /usr/local/bin/azcopy10
RUN mkdir -p /opt/hostedtoolcache \ RUN if [[ -f "/etc/fwupd/daemon.conf" ]]; then \
&& chown runner:runner /opt/hostedtoolcache \ sed -i 's/UpdateMotd=true/UpdateMotd=false/g' /etc/fwupd/daemon.conf; \
&& chmod 0755 /opt/hostedtoolcache fi
RUN echo 'session required pam_limits.so' >> /etc/pam.d/common-session \
&& echo 'session required pam_limits.so' >> /etc/pam.d/common-session-noninteractive \
&& echo 'DefaultLimitNOFILE=65536' >> /etc/systemd/system.conf \
&& echo 'DefaultLimitSTACK=16M:infinity' >> /etc/systemd/system.conf \
\
&& echo '* soft nofile 65536' >> /etc/security/limits.conf \
&& echo '* hard nofile 65536' >> /etc/security/limits.conf \
\
&& echo '* soft stack 16384' >> /etc/security/limits.conf \
&& echo '* hard stack 16384' >> /etc/security/limits.conf
USER runner USER runner
WORKDIR /workspace WORKDIR /workspace