mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-06 09:15:49 -05:00
build: cache more standard image layers (#5133)
Run the steps to copy super-linter configs and executables in both the standard and the slim images so that we can cache the steps to install additional linters for the standard image even if we modify super-linter configs and executables.
This commit is contained in:
parent
5219feefab
commit
bf832c60ae
1 changed files with 17 additions and 7 deletions
24
Dockerfile
24
Dockerfile
|
@ -358,9 +358,6 @@ COPY --chmod=555 scripts/bash-exec.sh /usr/bin/bash-exec
|
||||||
#########################
|
#########################
|
||||||
# Configure Environment #
|
# Configure Environment #
|
||||||
#########################
|
#########################
|
||||||
# Set image variant
|
|
||||||
ENV IMAGE="slim"
|
|
||||||
|
|
||||||
ENV PATH="${PATH}:/venvs/ansible-lint/bin"
|
ENV PATH="${PATH}:/venvs/ansible-lint/bin"
|
||||||
ENV PATH="${PATH}:/venvs/black/bin"
|
ENV PATH="${PATH}:/venvs/black/bin"
|
||||||
ENV PATH="${PATH}:/venvs/checkov/bin"
|
ENV PATH="${PATH}:/venvs/checkov/bin"
|
||||||
|
@ -384,6 +381,10 @@ ENV PATH="${PATH}:${DART_SDK}/bin:/root/.pub-cache/bin"
|
||||||
RUN terrascan init \
|
RUN terrascan init \
|
||||||
&& touch ~/.chktexrc
|
&& touch ~/.chktexrc
|
||||||
|
|
||||||
|
ENTRYPOINT ["/action/lib/linter.sh"]
|
||||||
|
|
||||||
|
FROM base_image as slim
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# Copy linter configuration files #
|
# Copy linter configuration files #
|
||||||
###################################
|
###################################
|
||||||
|
@ -394,9 +395,7 @@ COPY TEMPLATES /action/lib/.automation
|
||||||
#################################
|
#################################
|
||||||
COPY lib /action/lib
|
COPY lib /action/lib
|
||||||
|
|
||||||
ENTRYPOINT ["/action/lib/linter.sh"]
|
ENV IMAGE="slim"
|
||||||
|
|
||||||
FROM base_image as slim
|
|
||||||
|
|
||||||
# Run to build version file and validate image
|
# Run to build version file and validate image
|
||||||
RUN ACTIONS_RUNNER_DEBUG=true WRITE_LINTER_VERSIONS_FILE=true IMAGE="${IMAGE}" /action/lib/linter.sh
|
RUN ACTIONS_RUNNER_DEBUG=true WRITE_LINTER_VERSIONS_FILE=true IMAGE="${IMAGE}" /action/lib/linter.sh
|
||||||
|
@ -427,7 +426,6 @@ ARG PWSH_DIRECTORY='/usr/lib/microsoft/powershell'
|
||||||
ARG PSSA_VERSION='1.21.0'
|
ARG PSSA_VERSION='1.21.0'
|
||||||
|
|
||||||
ENV ARM_TTK_PSD1="/usr/lib/microsoft/arm-ttk/arm-ttk.psd1"
|
ENV ARM_TTK_PSD1="/usr/lib/microsoft/arm-ttk/arm-ttk.psd1"
|
||||||
ENV IMAGE="standard"
|
|
||||||
ENV PATH="${PATH}:/var/cache/dotnet/tools:/usr/share/dotnet"
|
ENV PATH="${PATH}:/var/cache/dotnet/tools:/usr/share/dotnet"
|
||||||
|
|
||||||
# Install super-linter runtime dependencies
|
# Install super-linter runtime dependencies
|
||||||
|
@ -461,6 +459,18 @@ RUN --mount=type=secret,id=GITHUB_TOKEN /install-pwsh.sh && rm -rf /install-pwsh
|
||||||
COPY scripts/install-arm-ttk.sh /
|
COPY scripts/install-arm-ttk.sh /
|
||||||
RUN --mount=type=secret,id=GITHUB_TOKEN /install-arm-ttk.sh && rm -rf /install-arm-ttk.sh
|
RUN --mount=type=secret,id=GITHUB_TOKEN /install-arm-ttk.sh && rm -rf /install-arm-ttk.sh
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Copy linter configuration files #
|
||||||
|
###################################
|
||||||
|
COPY TEMPLATES /action/lib/.automation
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# Copy super-linter executables #
|
||||||
|
#################################
|
||||||
|
COPY lib /action/lib
|
||||||
|
|
||||||
|
ENV IMAGE="standard"
|
||||||
|
|
||||||
# Run to build version file and validate image again because we installed more linters
|
# Run to build version file and validate image again because we installed more linters
|
||||||
RUN ACTIONS_RUNNER_DEBUG=true WRITE_LINTER_VERSIONS_FILE=true IMAGE="${IMAGE}" /action/lib/linter.sh
|
RUN ACTIONS_RUNNER_DEBUG=true WRITE_LINTER_VERSIONS_FILE=true IMAGE="${IMAGE}" /action/lib/linter.sh
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue