-
Notifications
You must be signed in to change notification settings - Fork 68
/
Dockerfile
196 lines (183 loc) · 7.63 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
#
# Aerospike Server Dockerfile
#
# http://github.com/aerospike/aerospike-server.docker
#
FROM ubuntu:22.04
LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \
org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \
org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \
org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \
org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \
org.opencontainers.image.vendor="Aerospike" \
org.opencontainers.image.version="7.1.0.0" \
org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker"
# AEROSPIKE_EDITION - required - must be "community", "enterprise", or
# "federal".
# By selecting "community" you agree to the "COMMUNITY_LICENSE".
# By selecting "enterprise" you agree to the "ENTERPRISE_LICENSE".
# By selecting "federal" you agree to the "FEDERAL_LICENSE"
ARG AEROSPIKE_EDITION="enterprise"
ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.0/aerospike-server-enterprise_7.1.0.0_tools-11.0.0_ubuntu22.04_x86_64.tgz"
ARG AEROSPIKE_SHA_X86_64="db6b69aa3e4a39ae6ec9f23845f98bfc12a2cb40672648f860cbc88e9ebc1999"
ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.0/aerospike-server-enterprise_7.1.0.0_tools-11.0.0_ubuntu22.04_aarch64.tgz"
ARG AEROSPIKE_SHA_AARCH64="2d253419b4c7a8b7a4b7416d22fbfdc46ee1e25df9c1d75ce38d3be0f62b5a53"
SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"]
# Install Aerospike Server and Tools
RUN \
{ \
# 00-prelude-deb.part - Setup dependencies for scripts.
export DEBIAN_FRONTEND=noninteractive; \
apt-get update -y; \
apt-get install -y --no-install-recommends apt-utils; \
apt-get install -y --no-install-recommends \
binutils \
ca-certificates \
curl \
xz-utils; \
}; \
{ \
# 00-prelude-deb.part - Install procps for tests.
apt-get install -y --no-install-recommends procps; \
}; \
{ \
# 10-download.part - Vars used for tini and tools.
VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \
}; \
{ \
# 10-common.part - Install tini.
ARCH="$(dpkg --print-architecture)"; \
if [ "${ARCH}" = "amd64" ]; then \
sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \
suffix=""; \
elif [ "${ARCH}" = "arm64" ]; then \
sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \
suffix="-arm64"; \
else \
echo "Unsuported architecture - ${ARCH}" >&2; \
exit 1; \
fi; \
curl -fsSL "https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}" --output /usr/bin/as-tini-static; \
echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \
chmod +x /usr/bin/as-tini-static; \
}; \
{ \
# 10-download.part - Download server and tools.
ARCH="$(dpkg --print-architecture)"; \
mkdir -p aerospike/pkg; \
if [ "${ARCH}" = "amd64" ]; then \
pkg_link="${AEROSPIKE_X86_64_LINK}"; \
sha256="${AEROSPIKE_SHA_X86_64}"; \
elif [ "${ARCH}" = "arm64" ]; then \
pkg_link="${AEROSPIKE_AARCH64_LINK}"; \
sha256="${AEROSPIKE_SHA_AARCH64}"; \
else \
echo "Unsuported architecture - ${ARCH}" >&2; \
exit 1; \
fi; \
if ! curl -fsSL "${pkg_link}" --output aerospike-server.tgz; then \
echo "Could not fetch pkg - ${pkg_link}" >&2; \
exit 1; \
fi; \
echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \
tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \
rm aerospike-server.tgz; \
# These directories are required for backward compatibility.
mkdir -p /var/{log,run}/aerospike; \
# Copy license file to standard location.
mkdir -p /licenses; \
cp aerospike/LICENSE /licenses; \
}; \
{ \
# 20-install-dependencies-deb.part - Install server and dependencies.
if [ "${AEROSPIKE_EDITION}" = "enterprise" ]; then \
apt-get install -y --no-install-recommends \
libcurl4 \
libldap-2.4.2; \
elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \
apt-get install -y --no-install-recommends \
libcurl4; \
fi; \
dpkg -i aerospike/aerospike-server-*.deb; \
rm -rf /opt/aerospike/bin; \
}; \
{ \
# 20-install-dependencies-deb.part - Install tools dependencies.
if ! [ "$(printf "%s\n%s" "${VERSION}" "5.1" | sort -V | head -1)" != "${VERSION}" ]; then \
# Tools before 5.1 need python2.
apt-get install -y --no-install-recommends \
python2; \
elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \
# Tools before 6.0 need python3.
apt-get install -y --no-install-recommends \
python3 \
python3-distutils; \
fi; \
# Tools after 6.0 bundled their own python interpreter.
}; \
{ \
# 20-install-dependencies-deb.part - Extract tools.
ar -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \
tar xf aerospike/pkg/data.tar.xz -C aerospike/pkg/; \
}; \
{ \
# 30-install-tools.part - install asinfo and asadm.
find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \
mv aerospike/pkg/etc/aerospike/astools.conf /etc/aerospike; \
if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2" | sort -V | head -1)" != "${VERSION}" ]; then \
mv aerospike/pkg/opt/aerospike/bin/aql /usr/bin; \
fi; \
if [ -d 'aerospike/pkg/opt/aerospike/bin/asadm' ]; then \
# Since tools release 7.0.5, asadm has been moved from
# /opt/aerospike/bin/asadm to /opt/aerospike/bin/asadm/asadm
# (inside an asadm directory).
mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/; \
else \
mkdir /usr/lib/asadm; \
mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/asadm/; \
fi; \
ln -s /usr/lib/asadm/asadm /usr/bin/asadm; \
if [ -f 'aerospike/pkg/opt/aerospike/bin/asinfo' ]; then \
# Since tools release 7.1.1, asinfo has been moved from
# /opt/aerospike/bin/asinfo to /opt/aerospike/bin/asadm/asinfo
# (inside an asadm directory).
mv aerospike/pkg/opt/aerospike/bin/asinfo /usr/lib/asadm/; \
fi; \
ln -s /usr/lib/asadm/asinfo /usr/bin/asinfo; \
}; \
{ \
# 40-cleanup.part - remove extracted aerospike pkg directory.
rm -rf aerospike; \
}; \
{ \
# 50-remove-prelude-deb.part - Remove dependencies for scripts.
rm -rf /var/lib/apt/lists/*; \
dpkg --purge \
apt-utils \
binutils \
ca-certificates \
curl \
xz-utils 2>&1; \
apt-get purge -y; \
apt-get autoremove -y; \
unset DEBIAN_FRONTEND; \
}; \
echo "done";
# Add the Aerospike configuration specific to this dockerfile
COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf
# Mount the Aerospike data directory
# VOLUME ["/opt/aerospike/data"]
# Mount the Aerospike config directory
# VOLUME ["/etc/aerospike/"]
# Expose Aerospike ports
#
# 3000 – service port, for client connections
# 3001 – fabric port, for cluster communication
# 3002 – mesh port, for cluster heartbeat
#
EXPOSE 3000 3001 3002
COPY entrypoint.sh /entrypoint.sh
# Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM
ENTRYPOINT ["/usr/bin/as-tini-static", "-r", "SIGUSR1", "-t", "SIGTERM", "--", "/entrypoint.sh"]
# Execute the run script in foreground mode
CMD ["asd"]