-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
288 lines (262 loc) · 11 KB
/
Dockerfile
File metadata and controls
288 lines (262 loc) · 11 KB
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
# ─────────────────────────────────────────────────────────────────────────────
# Stage 1: fetch mkcert + lazydocker + runtime versions json
# ─────────────────────────────────────────────────────────────────────────────
FROM alpine:latest AS fetch
SHELL ["/bin/sh", "-euo", "pipefail", "-c"]
ENV DIR=/usr/local/bin
COPY scripts/shells/composer-setup.sh /tmp/composer-setup
RUN apk add --no-cache curl bash ca-certificates jq php php-phar php-common php-openssl php-mbstring \
&& update-ca-certificates \
&& mkdir -p /out \
&& curl -fsSJL -o /out/mkcert "https://dl.filippo.io/mkcert/latest?for=linux/amd64" \
&& chmod +x /out/mkcert \
&& curl -fsSL "https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh" | bash \
&& cp /usr/local/bin/lazydocker /out/lazydocker \
&& chmod +x /out/lazydocker \
&& chmod +x /tmp/composer-setup \
&& COMPOSER_INSTALL_DIR=/out COMPOSER_FILENAME=composer /tmp/composer-setup
RUN <<'SH'
set -euo pipefail
tmp="$(mktemp -d)"
curl -fsSL --retry 3 --retry-delay 1 --retry-all-errors \
"https://endoflife.date/api/v1/products/php/" \
-o "$tmp/php.json"
curl -fsSL --retry 3 --retry-delay 1 --retry-all-errors \
"https://endoflife.date/api/v1/products/nodejs/" \
-o "$tmp/node.json"
cat > "$tmp/build-versions.jq" <<'JQ'
def nowiso: (now | todateiso8601);
def sort_node: sort_by(.version|tonumber) | reverse;
def sort_php: sort_by(.version) | reverse;
def php_releases: ($php[0].result.releases // []);
def node_releases: ($node[0].result.releases // []);
def node_current_major:
(node_releases
| map(select(.isEol == false and .isLts == false))
| max_by(.name|tonumber)
| .name);
def node_lts_major:
(node_releases
| map(select(.isEol == false and .isLts == true))
| max_by(.name|tonumber)
| .name);
{
generated_at: nowiso,
sources: {
php: "https://endoflife.date/api/v1/products/php/",
node: "https://endoflife.date/api/v1/products/nodejs/"
},
php: {
active: (
php_releases
| map(select(.isMaintained == true))
| map({ version: .name, debut: .releaseDate, eol: .eolFrom })
| sort_php
),
deprecated: (
php_releases
| map(select(.isMaintained == false))
| map({ version: .name, eol: .eolFrom })
| sort_php
),
all: (
php_releases
| map({ version: .name, debut: .releaseDate, eol: .eolFrom, maintained: .isMaintained })
| sort_php
)
},
node: {
tags: { current: node_current_major, lts: node_lts_major },
active: (
node_releases
| map(select(.isEol == false))
| map({ version: .name, label: .label, debut: .releaseDate, eol: .eolFrom, lts: .isLts })
| sort_node
),
deprecated: (
node_releases
| map(select(.isEol == true))
| map({ version: .name, label: .label, eol: .eolFrom })
| sort_node
),
all: (
node_releases
| map({ version: .name, label: .label, debut: .releaseDate, eol: .eolFrom, eolFlag: .isEol, lts: .isLts })
| sort_node
)
}
}
JQ
jq -n --slurpfile php "$tmp/php.json" --slurpfile node "$tmp/node.json" \
-f "$tmp/build-versions.jq" > /out/runtime-versions.json
chmod 644 /out/runtime-versions.json
rm -rf "$tmp"
SH
# ─────────────────────────────────────────────────────────────────────────────
# Stage 2: runtime/tools image
# ─────────────────────────────────────────────────────────────────────────────
FROM alpine:latest
LABEL org.opencontainers.image.source="https://github.com/infocyph/docker-tools"
LABEL org.opencontainers.image.description="Tools"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.authors="infocyph,abmmhasan"
ENV PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:$PATH" \
CAROOT=/etc/share/rootCA \
NOTIFY_FIFO=/run/notify.fifo \
NOTIFY_TCP_PORT=9901 \
NOTIFY_PREFIX=__HOST_NOTIFY__ \
NOTIFY_TOKEN="" \
RUNTIME_VERSIONS_DB=/etc/share/runtime-versions.json \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
EDITOR=nano \
VISUAL=nano \
SOPS_BASE_DIR=/etc/share/sops \
SOPS_KEYS_DIR=/etc/share/sops/keys \
SOPS_CFG_DIR=/etc/share/sops/config \
SOPS_GLOBAL_DIR=/etc/share/sops/global \
SOPS_REPO_DIR=/etc/share/vhosts/sops \
ADMIN_PANEL_AUTOSTART=1 \
ADMIN_PANEL_PORT=9911 \
ADMIN_PANEL_BIND=0.0.0.0 \
ADMIN_PANEL_DOCROOT=/etc/share/admin-panel \
ADMIN_PANEL_PHP_SERVER_LOG=/tmp/admin-panel-php-server.log \
ADMIN_PANEL_PRODUCT_NAME=LocalDevStack \
ADMIN_PANEL_BRAND_NAME=docker-tools \
ADMIN_PANEL_COMPANY_NAME=infocyph \
ADMIN_PANEL_CRON_DIR=/etc/share/scheduler/cron-jobs \
ADMIN_PANEL_SUPERVISOR_DIR=/etc/share/scheduler/supervisor \
ADMIN_PANEL_RUNNER_CONTAINER=RUNNER \
ADMIN_PANEL_RUNNER_SUPERVISOR_CONF=/etc/supervisor/supervisord.conf \
GIT_CONFIG_GLOBAL=/git-config/.gitconfig \
BANNER_SHOWN=0 \
HOST_OS=${HOST_OS:-linux}
RUN apk add --no-cache \
curl git wget ca-certificates bash coreutils net-tools nss iputils-ping ncdu jq tree \
nmap openssl ncurses tzdata figlet musl-locales gawk sqlite socat age sops \
docker-cli docker-cli-compose yq ripgrep fd shellcheck zip unzip nano nano-syntax \
bind-tools iproute2 traceroute mtr netcat-openbsd ripgrep gzip \
lnav multitail less php php-mbstring php-curl php-zip php-phar php-openssl php-common \
&& update-ca-certificates \
&& mkdir -p \
/etc/mkcert \
/etc/share/rootCA \
/etc/share/vhosts/docker-compose \
/etc/share/vhosts/apache \
/etc/share/vhosts/nginx \
/etc/share/vhosts/sops \
/etc/share/vhosts/fpm \
/etc/share/vhosts/composer \
/etc/share/sops/global \
/etc/share/sops/keys \
/etc/share/sops/config \
/etc/share/state \
/etc/share/logviewer \
/etc/share/admin-panel \
/etc/share/scheduler/cron-jobs \
/etc/share/scheduler/supervisor \
/etc/share/certs \
/git-config \
&& chmod 700 /etc/share/sops/global /etc/share/sops/keys /etc/share/sops/config \
&& rm -rf /tmp/* /var/tmp/*
SHELL ["/bin/bash", "-c"]
COPY --from=fetch /out/mkcert /usr/local/bin/mkcert
COPY --from=fetch /out/lazydocker /usr/local/bin/lazydocker
COPY --from=fetch /out/composer /usr/local/bin/composer
COPY --from=fetch /out/runtime-versions.json /etc/share/runtime-versions.json
COPY scripts/shells/certify.sh /usr/local/bin/certify
COPY scripts/shells/mkhost.sh /usr/local/bin/mkhost
COPY scripts/shells/rmhost.sh /usr/local/bin/rmhost
COPY scripts/shells/es-policy.sh /usr/local/bin/es-policy
COPY scripts/shells/notifierd.sh /usr/local/bin/notifierd
COPY scripts/shells/notify.sh /usr/local/bin/notify
COPY scripts/shells/senv.sh /usr/local/bin/senv
COPY scripts/shells/domain-which.sh /usr/local/bin/domain-which
COPY scripts/shells/status.sh /usr/local/bin/status
COPY scripts/shells/monitor-flows.sh /usr/local/bin/monitor-flows
COPY scripts/shells/monitor-runtime.sh /usr/local/bin/monitor-runtime
COPY scripts/shells/monitor-tls.sh /usr/local/bin/monitor-tls
COPY scripts/shells/monitor-db.sh /usr/local/bin/monitor-db
COPY scripts/shells/monitor-volumes.sh /usr/local/bin/monitor-volumes
COPY scripts/shells/monitor-queue.sh /usr/local/bin/monitor-queue
COPY scripts/shells/monitor-slo.sh /usr/local/bin/monitor-slo
COPY scripts/shells/monitor-log-heatmap.sh /usr/local/bin/monitor-log-heatmap
COPY scripts/shells/monitor-drift.sh /usr/local/bin/monitor-drift
COPY scripts/shells/monitor-alerts.sh /usr/local/bin/monitor-alerts
COPY scripts/shells/env-store.sh /usr/local/bin/env-store
COPY scripts/shells/profile-chooser.sh /usr/local/bin/profile-chooser
COPY scripts/shells/init-php-dirs.sh /usr/local/bin/init-php-dirs
COPY scripts/shells/git-default.sh /usr/local/bin/git-default
COPY scripts/shells/entrypoint.sh /usr/local/bin/entrypoint
COPY scripts/tests/ /etc/share/scripts/tests/
COPY scripts/http-templates/ /etc/http-templates/
COPY scripts/docker-templates/ /etc/docker-templates/
COPY scripts/fpm-templates/ /etc/fpm-templates/
COPY scripts/admin-panel/ /etc/share/admin-panel
ADD https://raw.githubusercontent.com/infocyph/Toolset/main/Git/gitx /usr/local/bin/gitx
ADD https://raw.githubusercontent.com/infocyph/Scriptomatic/master/bash/banner.sh /usr/local/bin/show-banner
ADD https://raw.githubusercontent.com/infocyph/Toolset/main/ChromaCat/chromacat /usr/local/bin/chromacat
ADD https://raw.githubusercontent.com/infocyph/Toolset/main/Sqlite/sqlitex /usr/local/bin/sqlitex
ADD https://raw.githubusercontent.com/infocyph/Toolset/main/Network/netx /usr/local/bin/netx
RUN chmod +x \
/usr/local/bin/gitx \
/usr/local/bin/git-default \
/usr/local/bin/certify \
/usr/local/bin/mkhost \
/usr/local/bin/rmhost \
/usr/local/bin/show-banner \
/usr/local/bin/chromacat \
/usr/local/bin/sqlitex \
/usr/local/bin/netx \
/usr/local/bin/notifierd \
/usr/local/bin/notify \
/usr/local/bin/entrypoint \
/usr/local/bin/mkcert \
/usr/local/bin/lazydocker \
/usr/local/bin/es-policy \
/usr/local/bin/senv \
/usr/local/bin/domain-which \
/usr/local/bin/status \
/usr/local/bin/monitor-flows \
/usr/local/bin/monitor-runtime \
/usr/local/bin/monitor-tls \
/usr/local/bin/monitor-db \
/usr/local/bin/monitor-volumes \
/usr/local/bin/monitor-queue \
/usr/local/bin/monitor-slo \
/usr/local/bin/monitor-log-heatmap \
/usr/local/bin/monitor-drift \
/usr/local/bin/monitor-alerts \
/usr/local/bin/env-store \
/usr/local/bin/profile-chooser \
/usr/local/bin/init-php-dirs \
/usr/local/bin/composer \
/etc/share/scripts/tests/senv-smoke.sh \
&& init-php-dirs \
&& chmod -R 755 /etc/share/vhosts \
&& mkdir -p /etc/profile.d \
&& { \
echo 'set linenumbers'; \
echo 'set softwrap'; \
echo 'set tabsize 2'; \
if [ -d /usr/share/nano ] && ls /usr/share/nano/*.nanorc >/dev/null 2>&1; then \
echo 'include "/usr/share/nano/*.nanorc"'; \
fi; \
} > /etc/nanorc \
&& { \
echo '#!/bin/sh'; \
echo 'if [ "${BANNER_SHOWN:-0}" = "0" ] && [ -n "$PS1" ]; then'; \
echo ' export BANNER_SHOWN=1'; \
echo ' show-banner "Tools"'; \
echo 'fi'; \
} > /etc/profile.d/banner-hook.sh \
&& chmod +x /etc/profile.d/banner-hook.sh \
&& { \
echo 'if [ "${BANNER_SHOWN:-0}" = "0" ] && [ -n "$PS1" ]; then'; \
echo ' export BANNER_SHOWN=1'; \
echo ' show-banner "Tools"'; \
echo 'fi'; \
} >> /root/.bashrc
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/entrypoint"]
CMD ["/usr/local/bin/notifierd"]