-
-
Notifications
You must be signed in to change notification settings - Fork 232
/
Dockerfile
427 lines (370 loc) · 19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# MEGA-LINTER FLAVOR [dotnet]: Optimized for C, C++, C# or VB based projects
###########################################
###########################################
## Dockerfile to run MegaLinter ##
###########################################
###########################################
# @not-generated
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#FROM__START
FROM mvdan/shfmt:latest-alpine as shfmt
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
FROM mstruebing/editorconfig-checker:2.4.0 as editorconfig-checker
FROM yoheimuta/protolint:latest as protolint
FROM zricethezav/gitleaks:v8.15.3 as gitleaks
#FROM__END
##################
# Get base image #
##################
# 3.10.5 is not usable until https://github.com/jruere/multiprocessing-logging/issues/56 is fixed
FROM python:3.10.4-alpine3.16
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#ARG__START
ARG PWSH_VERSION='latest'
ARG PWSH_DIRECTORY='/opt/microsoft/powershell'
ARG ARM_TTK_NAME='master.zip'
ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip'
ARG ARM_TTK_DIRECTORY='/opt/microsoft'
ARG BICEP_EXE='bicep'
ARG BICEP_URI='https://github.com/Azure/bicep/releases/latest/download/bicep-linux-musl-x64'
ARG BICEP_DIR='/usr/local/bin'
ARG PSSA_VERSION='latest'
#ARG__END
####################
# Run APK installs #
####################
WORKDIR /
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#APK__START
RUN apk add --update --no-cache \
bash \
ca-certificates \
curl \
gcc \
git \
git-lfs \
libffi-dev \
make \
musl-dev \
openssh \
go \
icu-libs \
libcurl \
libintl \
libssl1.1 \
libstdc++ \
lttng-ust-dev \
zlib \
zlib-dev \
openjdk11 \
nodejs \
npm \
yarn \
libc-dev \
libxml2-dev \
libxml2-utils \
libgcc \
nodejs-current \
ruby \
ruby-dev \
ruby-bundler \
ruby-rdoc \
&& git config --global core.autocrlf true
#APK__END
# PATH for golang & python
ENV GOROOT=/usr/lib/go \
GOPATH=/go
# PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/
# hadolint ignore=DL3044
ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \
# Ignore npm package issues
yarn config set ignore-engines true || true
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
#PIP__END
#PIPVENV__START
RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \
&& mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \
&& mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \
&& mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \
&& mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging==21.3 checkov && deactivate && cd ./../.. \
&& mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \
&& mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \
&& mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \
&& mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \
&& mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \
&& mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \
&& find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache
ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cpplint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin
#PIPVENV__END
############################
# Install NPM dependencies #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
ENV NODE_OPTIONS="--max-old-space-size=8192" \
NODE_ENV=production
#NPM__START
WORKDIR /node-deps
RUN npm --no-cache install --ignore-scripts \
jscpd@3.3.26 \
stylelint \
stylelint-config-standard \
stylelint-config-sass-guidelines \
stylelint-scss \
gherkin-lint \
graphql \
graphql-schema-linter \
npm-groovy-lint \
htmlhint \
@prantlf/jsonlint \
eslint \
eslint-plugin-jsonc \
@microsoft/eslint-formatter-sarif \
v8r \
prettier \
npm-package-json-lint \
npm-package-json-lint-config-default \
markdownlint-cli \
markdown-link-check \
markdown-table-formatter \
@stoplight/spectral@5.6.0 \
secretlint \
@secretlint/secretlint-rule-preset-recommend \
@secretlint/secretlint-formatter-sarif \
cspell \
sql-lint \
tekton-lint && \
npm audit fix --audit-level=critical || true \
&& npm cache clean --force || true \
&& rm -rf /root/.npm/_cacache \
&& find . -name "*.d.ts" -delete \
&& find . -name "*.map" -delete \
&& find . -name "*.npmignore" -delete \
&& find . -name "*.travis.yml" -delete \
&& find . -name "CHANGELOG.md" -delete \
&& find . -name "README.md" -delete \
&& find . -name ".package-lock.json" -delete \
&& find . -name "package-lock.json" -delete \
&& find . -name "README.md" -delete
WORKDIR /
#NPM__END
# Add node packages to path #
ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
NODE_PATH="/node-deps/node_modules"
##############################
# Installs ruby dependencies #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#GEM__START
RUN echo 'gem: --no-document' >> ~/.gemrc && \
gem install \
scss_lint \
goodcheck
#GEM__END
##############################
# Installs rust dependencies #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#CARGO__START
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \
&& export PATH="/root/.cargo/bin:${PATH}" \
&& cargo install --force --locked sarif-fmt shellcheck-sarif \
&& rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup
ENV PATH="/root/.cargo/bin:${PATH}"
#CARGO__END
##############################
# COPY instructions #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#COPY__START
COPY --from=shfmt /bin/shfmt /usr/bin/
COPY --from=hadolint /bin/hadolint /usr/bin/hadolint
COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
COPY --from=protolint /usr/local/bin/protolint /usr/bin/
COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/
#COPY__END
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#OTHER__START
# ARM installation
RUN mkdir -p ${PWSH_DIRECTORY} \
&& curl --retry 5 --retry-delay 5 -s https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \
| grep browser_download_url \
| grep linux-alpine-x64 \
| cut -d '"' -f 4 \
| xargs -n 1 wget -O - \
| tar -xzC ${PWSH_DIRECTORY} \
&& ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \
# CSHARP installation
&& wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# POWERSHELL installation
RUN mkdir -p ${PWSH_DIRECTORY} \
&& curl --retry 5 --retry-delay 5 -s https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \
| grep browser_download_url \
| grep linux-alpine-x64 \
| cut -d '"' -f 4 \
| xargs -n 1 wget -O - \
| tar -xzC ${PWSH_DIRECTORY} \
&& ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \
&& chmod +x /usr/bin/pwsh
# VBDOTNET installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# actionlint installation
ENV GO111MODULE=on
RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache
# arm-ttk installation
ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1"
RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \
&& unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \
&& rm "${ARM_TTK_NAME}" \
&& ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \
&& chmod a+x /usr/bin/arm-ttk \
# bash-exec installation
&& printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \
&& chmod +x /usr/bin/bash-exec \
# shellcheck installation
&& ML_THIRD_PARTY_DIR="/third-party/shellcheck" \
&& mkdir -p ${ML_THIRD_PARTY_DIR} \
&& wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \
&& mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \
# shfmt installation
# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/
# bicep_linter installation
&& curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "${BICEP_URI}" \
&& chmod +x "${BICEP_EXE}" \
&& mv "${BICEP_EXE}" "${BICEP_DIR}" \
# dotnet-format installation
&& /usr/share/dotnet/dotnet tool install -g dotnet-format \
# csharpier installation
&& /usr/share/dotnet/dotnet tool install -g csharpier \
# hadolint installation
# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint
# editorconfig-checker installation
# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
# dotenv-linter installation
&& wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \
# ktlint installation
&& curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \
chmod a+x ktlint && \
mv "ktlint" /usr/bin/ \
# kubeval installation
&& ML_THIRD_PARTY_DIR="/third-party/kubeval" \
&& mkdir -p ${ML_THIRD_PARTY_DIR} \
&& wget -P ${ML_THIRD_PARTY_DIR} -q https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz \
&& tar xf ${ML_THIRD_PARTY_DIR}/kubeval-linux-amd64.tar.gz --directory ${ML_THIRD_PARTY_DIR} \
&& mv ${ML_THIRD_PARTY_DIR}/kubeval /usr/local/bin \
&& rm ${ML_THIRD_PARTY_DIR}/kubeval-linux-amd64.tar.gz \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \
# kubeconform installation
&& ML_THIRD_PARTY_DIR="/third-party/kubeconform" \
&& KUBECONFORM_VERSION=v0.5.0 \
&& mkdir -p ${ML_THIRD_PARTY_DIR} \
&& wget -P ${ML_THIRD_PARTY_DIR} -q https://github.com/yannh/kubeconform/releases/download/$KUBECONFORM_VERSION/kubeconform-linux-amd64.tar.gz \
&& tar xf ${ML_THIRD_PARTY_DIR}/kubeconform-linux-amd64.tar.gz --directory ${ML_THIRD_PARTY_DIR} \
&& mv ${ML_THIRD_PARTY_DIR}/kubeconform /usr/local/bin \
&& rm ${ML_THIRD_PARTY_DIR}/kubeconform-linux-amd64.tar.gz \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \
# checkmake installation
&& ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \
&& wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \
&& chmod 755 /usr/local/bin/checkmake \
# powershell installation
&& pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \
# powershell_formatter installation
# Next line commented because already managed by another linter
# RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force'
# protolint installation
# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/
# gitleaks installation
# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/
# trivy installation
&& wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.35.0 \
# misspell installation
&& ML_THIRD_PARTY_DIR="/third-party/misspell" \
&& mkdir -p ${ML_THIRD_PARTY_DIR} \
&& curl -L -o ${ML_THIRD_PARTY_DIR}/install-misspell.sh https://git.io/misspell \
&& sh .${ML_THIRD_PARTY_DIR}/install-misspell.sh \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \
&& find /tmp -path '/tmp/tmp.*' -type f -name 'misspell*' -delete -o -type d -empty -delete \
# tsqllint installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
&& dotnet tool install --global TSQLLint
#OTHER__END
################################
# Installs python dependencies #
################################
COPY megalinter /megalinter
RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \
&& PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \
&& rm -rf /var/cache/apk/* \
&& find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf
#######################################
# Copy scripts and rules to container #
#######################################
COPY megalinter/descriptors /megalinter-descriptors
COPY TEMPLATES /action/lib/.automation
###########################
# Get the build arguments #
###########################
ARG BUILD_DATE
ARG BUILD_REVISION
ARG BUILD_VERSION
#################################################
# Set ENV values used for debugging the version #
#################################################
ENV BUILD_DATE=$BUILD_DATE \
BUILD_REVISION=$BUILD_REVISION \
BUILD_VERSION=$BUILD_VERSION
#FLAVOR__START
ENV MEGALINTER_FLAVOR=dotnet
#FLAVOR__END
#########################################
# Label the instance and set maintainer #
#########################################
LABEL com.github.actions.name="MegaLinter" \
com.github.actions.description="The ultimate linters aggregator to make sure your projects are clean" \
com.github.actions.icon="code" \
com.github.actions.color="red" \
maintainer="Nicolas Vuillamy <nicolas.vuillamy@gmail.com>" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.revision=$BUILD_REVISION \
org.opencontainers.image.version=$BUILD_VERSION \
org.opencontainers.image.authors="Nicolas Vuillamy <nicolas.vuillamy@gmail.com>" \
org.opencontainers.image.url="https://megalinter.io" \
org.opencontainers.image.source="https://github.com/oxsecurity/megalinter" \
org.opencontainers.image.documentation="https://megalinter.io" \
org.opencontainers.image.vendor="Nicolas Vuillamy" \
org.opencontainers.image.description="Lint your code base with GitHub Actions"
#EXTRA_DOCKERFILE_LINES__START
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
#EXTRA_DOCKERFILE_LINES__END