forked from oxsecurity/megalinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
560 lines (468 loc) · 19.7 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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
###########################################
###########################################
## 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 cljkondo/clj-kondo:2022.04.25-alpine as clj-kondo
FROM hadolint/hadolint:v2.10.0-alpine as hadolint
FROM ghcr.io/assignuser/chktex-alpine:latest as chktex
FROM yoheimuta/protolint:latest as protolint
FROM ghcr.io/assignuser/lintr-lib:0.2.0 as lintr-lib
FROM ghcr.io/terraform-linters/tflint:v0.35.0 as tflint
FROM accurics/terrascan:latest as terrascan
FROM alpine/terragrunt:latest as terragrunt
FROM checkmarx/kics:alpine as kics
#FROM__END
##################
# Get base image #
##################
FROM python:3.9.7-alpine3.13
#############################################################################################
## @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 DART_VERSION='2.8.4'
ARG GLIBC_VERSION='2.31-r0'
ARG PSSA_VERSION='latest'
#ARG__END
####################
# Run APK installs #
####################
WORKDIR /
# APK Packages used by mega-linter core architecture
RUN apk add --update --no-cache \
bash \
ca-certificates \
coreutils \
curl \
file \
gcc \
git git-lfs\
go \
gnupg \
icu-libs \
krb5-libs \
libcurl libintl libssl1.1 libstdc++ \
libffi-dev \
linux-headers \
make \
musl-dev \
openjdk11 \
openssh \
npm \
nodejs \
py3-setuptools \
readline-dev \
ruby-bundler \
ruby-dev \
yarn
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#APK__START
RUN apk add --update --no-cache \
docker \
openrc \
lttng-ust-dev \
zlib \
zlib-dev \
go \
openjdk11 \
perl \
perl-dev \
php7 \
php7-phar \
php7-json \
php7-mbstring \
php7-xmlwriter \
php7-tokenizer \
php7-ctype \
php7-curl \
php7-dom \
php7-simplexml \
php8 \
php8-phar \
php8-mbstring \
php8-xmlwriter \
php8-tokenizer \
php8-ctype \
php8-curl \
php8-dom \
php8-simplexml \
composer \
dpkg \
ruby \
ruby-dev \
ruby-bundler \
ruby-rdoc \
R \
R-dev \
R-doc \
libc-dev \
libxml2-dev \
libxml2-utils \
libgcc
#APK__END
# Ignore npm package issues
RUN yarn config set ignore-engines true
# PATH for golang
ENV GOROOT=/usr/lib/go
ENV GOPATH=/go
# hadolint ignore=DL3044
ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#PIP__START
RUN pip3 install --no-cache-dir --upgrade pip && pip3 install --no-cache-dir --upgrade \
'ansible-lint[community,yamllint]' \
'cpplint' \
'cfn-lint' \
'pylint' \
'black' \
'flake8' \
'isort' \
'bandit' \
'mypy' \
'restructuredtext_lint' \
'rstcheck' \
'snakemake' \
'snakefmt' \
'sqlfluff' \
'yamllint'
#PIP__END
############################
# Install NPM dependencies #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
# Downgrade npm because from npm@v7, npm install crashes when called from root directory within Dockerfile
ENV NODE_OPTIONS="--max-old-space-size=8192"
#NPM__START
RUN npm install --no-cache --ignore-scripts \
sfdx-cli \
typescript \
asl-validator \
@coffeelint/cli \
jscpd@3.3.26 \
secretlint@4.1.0 \
@secretlint/secretlint-rule-preset-recommend@4.1.0 \
stylelint \
stylelint-config-standard \
stylelint-config-sass-guidelines \
stylelint-scss \
dockerfilelint \
editorconfig-checker \
gherkin-lint \
graphql-schema-linter \
npm-groovy-lint \
htmlhint \
eslint \
eslint-config-airbnb \
eslint-config-prettier \
eslint-config-standard \
eslint-plugin-import \
eslint-plugin-jest \
eslint-plugin-node \
eslint-plugin-prettier \
eslint-plugin-promise \
eslint-plugin-vue \
babel-eslint \
@babel/core \
@babel/eslint-parser \
standard@15.0.1 \
prettier \
jsonlint \
eslint-plugin-jsonc \
v8r@0.6.1 \
eslint-plugin-react \
eslint-plugin-jsx-a11y \
markdownlint-cli \
remark-cli \
remark-preset-lint-recommended \
markdown-link-check \
markdown-table-formatter \
@stoplight/spectral@5.6.0 \
cspell \
sql-lint \
tekton-lint \
prettyjson \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser
#NPM__END
# Add node packages to path #
ENV PATH="/node_modules/.bin:${PATH}"
##############################
# 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 \
puppet-lint \
rubocop \
rubocop-github \
rubocop-performance \
rubocop-rails \
rubocop-rspec
#GEM__END
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#OTHER__START
RUN rc-update add docker boot && rc-service docker start || true
# CSHARP installation
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 5.0 -version latest
ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# GIT installation
RUN git config --global core.autocrlf true
# JAVA installation
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"
# PHP installation
RUN wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \
&& wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \
&& PHAR_KEY_ID="0x9D8A98B29B2D5D79" \
&& ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \
|| gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \
|| gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \
|| gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \
&& gpg --verify phive.phar.asc phive.phar \
&& chmod +x phive.phar \
&& mv phive.phar /usr/local/bin/phive \
&& rm phive.phar.asc \
&& update-alternatives --install /usr/bin/php php /usr/bin/php7 100 \
&& update-alternatives --install /usr/bin/php php /usr/bin/php8 10
# 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
# RUST installation
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# SALESFORCE installation
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"
RUN echo y|sfdx plugins:install sfdx-hardis
# SCALA installation
RUN curl -fLo coursier https://git.io/coursier-cli && \
chmod +x coursier
# actionlint installation
ENV GO111MODULE=on
RUN go get github.com/rhysd/actionlint/cmd/actionlint
# 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
RUN 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
RUN 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 \
&& shellcheck --version
# shfmt installation
COPY --from=shfmt /bin/shfmt /usr/bin/
# clj-kondo installation
COPY --from=clj-kondo /bin/clj-kondo /usr/bin/
# dotnet-format installation
RUN /usr/share/dotnet/dotnet tool install -g dotnet-format
# dartanalyzer installation
RUN wget --tries=5 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& wget --tries=5 -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \
&& apk add --no-cache glibc-${GLIBC_VERSION}.apk && rm glibc-${GLIBC_VERSION}.apk \
&& wget --tries=5 https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip -O - -q | unzip -q - \
&& chmod +x dart-sdk/bin/dart* \
&& mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \
&& rm -r dart-sdk/
# hadolint installation
COPY --from=hadolint /bin/hadolint /usr/bin/hadolint
# dotenv-linter installation
RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s
# golangci-lint installation
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \
&& golangci-lint --version
# revive installation
RUN go get -u github.com/mgechev/revive
# checkstyle installation
RUN CHECKSTYLE_LATEST=$(curl -s https://api.github.com/repos/checkstyle/checkstyle/releases/latest \
| grep browser_download_url \
| grep ".jar" \
| cut -d '"' -f 4) \
&& curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \
--output /usr/bin/checkstyle
# ktlint installation
RUN 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
RUN 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 \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete
# kubeconform installation
RUN ML_THIRD_PARTY_DIR="/third-party/kubeconform" \
&& KUBECONFORM_VERSION=v0.4.12 \
&& 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 \
&& find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete
# chktex installation
COPY --from=chktex /usr/bin/chktex /usr/bin/
RUN cd ~ && touch .chktexrc
# luacheck installation
RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \
&& cd lua-5.3.5 \
&& make linux \
&& make install \
&& cd .. && rm -r lua-5.3.5/ \
&& wget --tries=5 https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \
&& cd luarocks-3.3.1-super-linter \
&& ./configure --with-lua-include=/usr/local/include \
&& make \
&& make -b install \
&& cd .. && rm -r luarocks-3.3.1-super-linter/ \
&& luarocks install luacheck
# perlcritic installation
RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic
# phpcs installation
RUN phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192
# phpstan installation
RUN phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720
# psalm installation
RUN phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
# phplint installation
RUN composer global require overtrue/phplint ^3.0 \
&& composer global config bin-dir --absolute
ENV PATH="/root/.composer/vendor/bin:$PATH"
# powershell installation
RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force'
# protolint installation
COPY --from=protolint /usr/local/bin/protolint /usr/bin/
# lintr installation
COPY --from=lintr-lib /usr/lib/R/library/ /home/r-library
RUN R -e "install.packages(list.dirs('/home/r-library',recursive = FALSE), repos = NULL, type = 'source')"
# raku installation
RUN curl -L https://github.com/nxadm/rakudo-pkg/releases/download/v2020.10-02/rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk > rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
&& apk add --no-cache --allow-untrusted rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
&& rm rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \
&& /opt/rakudo-pkg/bin/add-rakudo-to-path \
&& source /root/.profile \
&& /opt/rakudo-pkg/bin/install-zef-as-user
ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$PATH"
# clippy installation
RUN rustup component add clippy
# sfdx-scanner-apex installation
RUN sfdx plugins:install @salesforce/sfdx-scanner
# sfdx-scanner-aura installation
RUN sfdx plugins:install @salesforce/sfdx-scanner
# sfdx-scanner-lwc installation
RUN sfdx plugins:install @salesforce/sfdx-scanner
# scalafix installation
RUN ./coursier install scalafix --quiet --install-dir /usr/bin
# misspell installation
RUN 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
RUN dotnet tool install --global TSQLLint
# tflint installation
COPY --from=tflint /usr/local/bin/tflint /usr/bin/
# terrascan installation
COPY --from=terrascan /go/bin/terrascan /usr/bin/
# terragrunt installation
COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/
# terraform-fmt installation
COPY --from=terragrunt /bin/terraform /usr/bin/
# checkov installation
RUN pip3 install --upgrade --no-cache-dir pip && pip3 install --upgrade --no-cache-dir setuptools \
&& pip3 install --no-cache-dir checkov
# kics installation
COPY --from=kics /app/bin/kics /usr/bin/
RUN mkdir -p /opt/kics/assets
ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries
COPY --from=kics /app/bin/assets /opt/kics/assets/
#OTHER__END
######################
# Set the entrypoint #
######################
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
################################
# Installs python dependencies #
################################
COPY megalinter /megalinter
RUN python /megalinter/setup.py install \
&& python /megalinter/setup.py clean --all \
&& rm -rf /var/cache/apk/*
#######################################
# 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=all
#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.github.io" \
org.opencontainers.image.source="https://github.com/megalinter/megalinter" \
org.opencontainers.image.documentation="https://megalinter.github.io" \
org.opencontainers.image.vendor="Nicolas Vuillamy" \
org.opencontainers.image.description="Lint your code base with GitHub Actions"