-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
186 lines (176 loc) · 6.66 KB
/
Containerfile
File metadata and controls
186 lines (176 loc) · 6.66 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
# SPDX-FileCopyrightText: © 2026 Nfrastack <code@nfrastack.com>
#
# SPDX-License-Identifier: MIT
ARG \
DISTRO \
DISTRO_VARIANT
FROM docker.io/${DISTRO}:${DISTRO_VARIANT}
LABEL \
org.opencontainers.image.title="Base" \
org.opencontainers.image.description="Container Base Image" \
org.opencontainers.image.authors="Nfrastack <code@nfrastack.com>" \
org.opencontainers.image.url="https://hub.docker.com/r/nfrastack/base" \
org.opencontainers.image.documentation="https://github.com/nfrastack/container-base/blob/main/README.md" \
org.opencontainers.image.source="https://github.com/nfrastack/container-base.git" \
org.opencontainers.image.vendor="Nfrastack <https://www.nfrastack.com>" \
org.opencontainers.image.licenses="MIT"
ARG \
IMAGE_BASE_MODULES \
IMAGE_MODULES \
IMAGE_NAME \
IMAGE_BASE_VERSION \
IMAGE_BASE_REPO_URL \
TIMEZONE=Etc/GMT \
AGE_VERSION \
FLUENTBIT_VERSION \
INFISICAL_VERION \
OPENBAO_VERSION \
S6_OVERLAY_VERSION \
TAILSCALE_VERSION \
ZEROTIER_VERSION \
ZABBIX_VERSION
ENV \
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/local/lib;/usr/sbin:/usr/bin:/sbin:/bin:/command \
S6_KEEP_ENV=1 \
IMAGE_NAME="nfrastack/base" \
IMAGE_REPO_URL="https://github.com/nfrastack/container-base/"
COPY CHANGELOG.md /usr/src/build_image/CHANGELOG.md
COPY LICENSE /usr/src/build_image/LICENSE
COPY README.md /usr/src/build_image/README.md
COPY rootfs/ /
RUN case "$(grep -o '^ID=.*' /etc/os-release | cut -d = -f2)" in \
alpine ) \
apk update ; \
apk add -t .nfrastack-needed_do_not_remove bash ; \
;; \
esac
SHELL ["/bin/bash", "-c"]
RUN echo "" && \
source /container/base/functions/container/build && \
case "$(container_info distro)" in \
alpine ) \
if [ "$(grep -o '^PRETTY_NAME=.*' /etc/os-release | cut -d = -f2)" = '"Alpine Linux edge"' ] ; then \
apk add merge-usr ; \
merge-usr ; \
fi ; \
case "$(container_info variant)" in \
3.[5-9] | 3.1[1-6] ) \
alpine_ssl=libressl ; \
;; \
3.1[7-9] | 3.2[0-9] ) \
alpine_ssl=openssl ; \
;; \
esac ; \
\
case "$(container_info variant)" in \
3.[5-8] ) \
zstd_pacakge="" ; \
;; \
*) \
zstd_package="zstd" ; \
;; \
esac ; \
\
IMAGE_BASE_BUILD_DEPS_ALPINE=" \
gettext \
musl-dev \
" \
; \
IMAGE_BASE_RUN_DEPS_ALPINE=" \
acl \
${alpine_ssl} \
bash \
${busybox_extras} \
ca-certificates \
curl \
git \
grep \
libgcc \
$(apk search libssl1* -q) \
nano \
sudo \
tzdata \
xz \
${zstd_package} \
" \
; \
;; \
debian ) \
\
IMAGE_BASE_BUILD_DEPS_DEBIAN=" \
\
" \
; \
IMAGE_BASE_RUN_DEPS_DEBIAN=" \
acl \
apt-transport-https \
apt-utils \
aptitude \
busybox-static \
ca-certificates \
curl \
dirmngr \
gettext \
git \
gnupg \
nano \
procps \
sudo \
tar \
tzdata \
zstd \
" \
; \
;; \
esac ; \
\
package update && \
package upgrade && \
package install \
IMAGE_BASE_BUILD_DEPS \
IMAGE_BASE_RUN_DEPS \
&& \
\
mkdir -p \
/etc/bash/ \
/run/secrets \
/usr/local/bin \
/usr/local/sbin \
&& \
\
if [ -e "/usr/bin/envsubst" ] ; then mv /usr/bin/envsubst /usr/local/bin/envsubst ; fi && \
container_build_log base && \
rm -rf /etc/timezone && \
ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
echo "${TIMEZONE}" > /etc/timezone && \
case "$(container_info distro)" in \
"debian" ) \
dpkg-reconfigure -f noninteractive tzdata ; \
rm -rf \
/usr/bin/crontab \
/usr/sbin/cron \
; \
\
busybox --install -s /usr/bin ; \
;; \
esac ; \
\
_container_modules_parse IMAGE_BASE_MODULES && \
_container_modules_parse IMAGE_MODULES && \
package remove IMAGE_BASE_BUILD_DEPS && \
package cleanup && \
\
rm -rf \
/container/base/modules \
/etc/*.apk.new \
/etc/cron* \
/etc/issue \
/etc/periodic/{*,.??*} \
/etc/profile.d/{*,.??*} \
/media \
/usr/share/gnome/help/*/{*,.??*} \
/usr/share/info/{*,.??*} \
/usr/share/linda/{*,.??*} \
/usr/share/lintian/overrides/{*,.??*} \
/usr/share/omf/*/*-*.emf
ENTRYPOINT ["/init"]