-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathDockerfile
233 lines (197 loc) · 8.49 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
# syntax=docker/dockerfile:1
###########################################
###########################################
## Dockerfile to run MegaLinter ##
###########################################
###########################################
# @not-generated
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#FROM__START
#FROM__END
##################
# Get base image #
##################
FROM python:3.11.3-alpine3.17
ARG GITHUB_TOKEN
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#ARG__START
#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 \
npm \
nodejs-current \
yarn \
&& 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
#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 --omit=dev \
typescript \
standard \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser && \
echo "Cleaning npm cache…" \
&& npm cache clean --force || true \
&& echo "Changing owner of node_modules files…" \
&& chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \
&& echo "Removing extra node_module files…" \
&& 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
#GEM__END
##############################
# Installs rust dependencies #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#CARGO__START
#CARGO__END
##############################
# COPY instructions #
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#COPY__START
#COPY__END
#############################################################################################
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#OTHER__START
#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=none
#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
ENV ENABLE_LINTERS=TYPESCRIPT_STANDARD \
FLAVOR_SUGGESTIONS=false \
SINGLE_LINTER=TYPESCRIPT_STANDARD \
PRINT_ALPACA=false \
LOG_FILE=none \
SARIF_REPORTER=true \
TEXT_REPORTER=false \
UPDATED_SOURCES_REPORTER=false \
GITHUB_STATUS_REPORTER=false \
GITHUB_COMMENT_REPORTER=false \
EMAIL_REPORTER=false \
FILEIO_REPORTER=false \
CONFIG_REPORTER=false \
SARIF_TO_HUMAN=false
RUN mkdir /root/docker_ssh && mkdir /usr/bin/megalinter-sh
EXPOSE 22
COPY entrypoint.sh /entrypoint.sh
COPY sh /usr/bin/megalinter-sh
COPY sh/megalinter_exec /usr/bin/megalinter_exec
COPY sh/motd /etc/motd
RUN find /usr/bin/megalinter-sh/ -type f -iname "*.sh" -exec chmod +x {} \; && \
chmod +x entrypoint.sh && \
chmod +x /usr/bin/megalinter_exec && \
echo "alias megalinter='python -m megalinter.run'" >> ~/.bashrc && source ~/.bashrc && \
echo "alias megalinter_exec='/usr/bin/megalinter_exec'" >> ~/.bashrc && source ~/.bashrc
RUN export STANDALONE_LINTER_VERSION="$(python -m megalinter.run --input /tmp --linterversion)" && \
echo $STANDALONE_LINTER_VERSION
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
#EXTRA_DOCKERFILE_LINES__END