docker

Форк
0
/
alpine_3.9 
260 строк · 9.0 Кб
1
FROM alpine:3.9
2
MAINTAINER mail@racktear.com
3

4
RUN addgroup -S tarantool \
5
    && adduser -S -G tarantool tarantool \
6
    && apk add --no-cache 'su-exec>=0.2'
7

8
# An ARG instruction goes out of scope at the end of the build
9
# stage where it was defined. To use an arg in multiple stages,
10
# each stage must include the ARG instruction
11
ARG TNT_VER
12
ARG NPROC
13
ENV TARANTOOL_VERSION=${TNT_VER} \
14
    TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \
15
    TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \
16
    GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \
17
    GPERFTOOLS_TAG=gperftools-2.5 \
18
    LUAROCKS_URL=https://github.com/tarantool/luarocks/archive/6e6fe62d9409fe2103c0fd091cccb3da0451faf5.tar.gz \
19
    LUAROCK_VSHARD_VERSION=0.1.18 \
20
    LUAROCK_AVRO_SCHEMA_VERSION=3.0.6 \
21
    LUAROCK_EXPERATIOND_VERSION=1.1.1 \
22
    LUAROCK_QUEUE_VERSION=1.1.0 \
23
    LUAROCK_CONNPOOL_VERSION=1.1.1 \
24
    LUAROCK_HTTP_VERSION=1.2.0 \
25
    LUAROCK_MEMCACHED_VERSION=1.0.1 \
26
    LUAROCK_METRICS_VERSION=0.12.0 \
27
    LUAROCK_TARANTOOL_PG_VERSION=2.0.2 \
28
    LUAROCK_TARANTOOL_MYSQL_VERSION=2.0.1 \
29
    LUAROCK_TARANTOOL_MQTT_VERSION=1.5.1 \
30
    LUAROCK_TARANTOOL_GIS_VERSION=1.0.0 \
31
    LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.4 \
32
    LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1
33

34
COPY files/gperftools_alpine.diff /
35

36
ARG ENABLE_BUNDLED_LIBYAML \
37
    LUAJIT_DISABLE_SYSPROF \
38
    GC64
39

40
RUN set -x \
41
    && apk add --no-cache --virtual .run-deps.1 \
42
        libstdc++ \
43
        readline \
44
        openssl \
45
        yaml \
46
        lz4 \
47
        binutils \
48
        ncurses \
49
        libgomp \
50
        lua \
51
        tar \
52
        zip \
53
        zlib \
54
        libunwind \
55
        icu \
56
        ca-certificates \
57
    && apk add --no-cache --virtual .build-deps.1 \
58
        gcc \
59
        g++ \
60
        cmake \
61
        file \
62
        readline-dev \
63
        openssl-dev \
64
        yaml-dev \
65
        bsd-compat-headers \
66
        lz4-dev \
67
        zlib-dev \
68
        binutils-dev \
69
        ncurses-dev \
70
        lua-dev \
71
        musl-dev \
72
        make \
73
        git \
74
        libunwind-dev \
75
        autoconf \
76
        automake \
77
        libtool \
78
        linux-headers \
79
        go \
80
        icu-dev \
81
        wget \
82
    && : "---------- gperftools ----------" \
83
    && mkdir -p /usr/src/gperftools \
84
    && git clone "$GPERFTOOLS_REPO" /usr/src/gperftools \
85
    && git -C /usr/src/gperftools checkout "$GPERFTOOLS_TAG" \
86
    && (cd /usr/src/gperftools; \
87
        patch -p1 < /gperftools_alpine.diff; \
88
        rm /gperftools_alpine.diff; \
89
        ./autogen.sh; \
90
        ./configure; \
91
        make -j ${NPROC}; \
92
        cp .libs/libprofiler.so* /usr/local/lib;) \
93
    && : "---------- pprof for gperftools ----------" \
94
    && : "To avoid of the issue:" \
95
    && : "'The master branch is Incompatible with go version < 1.13 #538'" \
96
    && : "https://github.com/google/pprof/issues/538" \
97
    && : "use latest workable commits with the old GO versions" \
98
    && ( export GOPATH=/root/go && \
99
       export PATH=${GOPATH}/bin:/usr/local/go/bin:$PATH && \
100
       export GOBIN=$GOROOT/bin && \
101
       mkdir -p ${GOPATH}/src ${GOPATH}/bin && \
102
       go get github.com/google/pprof || : && \
103
       cd /root/go/src/github.com/google/pprof && \
104
       git checkout 160c4290d1d8cee56daa51d7ba5d223291d392aa && \
105
       ( cd /root/go/src/github.com/chzyer/readline && \
106
       git checkout f6d7a1f6fbf35bbf9beb80dc63c56a29dcfb759f ) && \
107
       ( cd /root/go/src/github.com/ianlancetaylor/demangle && \
108
       git checkout 039b1ae3a3406573c84daaf91166d70ad2bc0519 ) && \
109
       go build && \
110
       cp pprof /usr/local/bin/pprof ) \
111
    && : "---------- tarantool ----------" \
112
    && mkdir -p /usr/src/tarantool \
113
    && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \
114
    && git -C /usr/src/tarantool checkout "$TARANTOOL_VERSION" \
115
    && git -C /usr/src/tarantool submodule update --init --recursive \
116
    && (cd /usr/src/tarantool; \
117
       echo "WARNING: Temporary fix for test/unit/cbus_hang test" ; \
118
       git cherry-pick d7fa6d34ab4e0956fe8a80966ba628e0e3f81067 2>/dev/null || \
119
           git cherry-pick --abort ; \
120
       cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo\
121
             -DENABLE_BUNDLED_LIBYAML:BOOL=${ENABLE_BUNDLED_LIBYAML}\
122
             -DENABLE_BACKTRACE:BOOL=ON\
123
             -DLUAJIT_DISABLE_SYSPROF:BOOL=${LUAJIT_DISABLE_SYSPROF} \
124
             -DLUAJIT_ENABLE_GC64:BOOL=${GC64} \
125
             -DENABLE_DIST:BOOL=ON\
126
             .) \
127
    && make -C /usr/src/tarantool -j ${NPROC} \
128
    && make -C /usr/src/tarantool install \
129
    && make -C /usr/src/tarantool clean \
130
    && : "---------- luarocks ----------" \
131
    && wget -O luarocks.tar.gz "$LUAROCKS_URL" \
132
    && mkdir -p /usr/src/luarocks \
133
    && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \
134
    && (cd /usr/src/luarocks; \
135
        ./configure; \
136
        make -j build; \
137
        make install) \
138
    && rm -r /usr/src/luarocks \
139
    && rm -rf /usr/src/tarantool \
140
    && rm -rf /usr/src/gperftools \
141
    && rm -rf /usr/src/go \
142
    && : "---------- remove build deps ----------" \
143
    && apk del .build-deps.1
144

145
RUN mkdir -p /usr/local/etc/luarocks \
146
    && mkdir -p /usr/local/etc/tarantool/rocks
147

148
COPY files/luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua
149
COPY files/luarocks-config.lua /usr/local/etc/tarantool/rocks/config-5.1.lua
150

151
ARG ROCKS_INSTALLER
152
RUN set -x \
153
    && apk add --no-cache --virtual .run-deps.2 \
154
        mariadb-connector-c-dev \
155
        libpq \
156
        cyrus-sasl \
157
        libev \
158
    && apk add --no-cache --virtual .build-deps.2 \
159
        git \
160
        cmake \
161
        make \
162
        coreutils \
163
        gcc \
164
        g++ \
165
        postgresql-dev \
166
        lua-dev \
167
        musl-dev \
168
        cyrus-sasl-dev \
169
        libev-dev \
170
        wget \
171
        unzip \
172
    && mkdir -p /rocks \
173
    && : "---------- proj (for gis module) ----------" \
174
    && wget -O proj.tar.gz http://download.osgeo.org/proj/proj-4.9.3.tar.gz \
175
    && mkdir -p /usr/src/proj \
176
    && tar -xzf proj.tar.gz -C /usr/src/proj --strip-components=1 \
177
    && (cd /usr/src/proj; \
178
        ./configure; \
179
        make -j ${NPROC}; \
180
        make install) \
181
    && rm -r /usr/src/proj \
182
    && rm -rf /usr/src/proj \
183
    && rm -rf /proj.tar.gz \
184
    && : "---------- geos (for gis module) ----------" \
185
    && wget -O geos.tar.bz2 http://download.osgeo.org/geos/geos-3.6.0.tar.bz2 \
186
    && mkdir -p /usr/src/geos \
187
    && tar -xjf geos.tar.bz2 -C /usr/src/geos --strip-components=1 \
188
    && (cd /usr/src/geos; \
189
        ./configure; \
190
        make -j ${NPROC}; \
191
        make install) \
192
    && rm -r /usr/src/geos \
193
    && rm -rf /usr/src/geos \
194
    && rm -rf /geos.tar.bz2 \
195
    && : "---------- luarocks ----------" \
196
    && : "ldoc" \
197
    && ${ROCKS_INSTALLER} install ldoc \
198
    && : "lua-term" \
199
    && ${ROCKS_INSTALLER} install lua-term \
200
    && : "avro" \
201
    && ${ROCKS_INSTALLER} install avro-schema $LUAROCK_AVRO_SCHEMA_VERSION \
202
    && : "expirationd" \
203
    && ${ROCKS_INSTALLER} install expirationd $LUAROCK_EXPERATIOND_VERSION \
204
    && : "queue" \
205
    && ${ROCKS_INSTALLER} install queue $LUAROCK_QUEUE_VERSION \
206
    && : "connpool" \
207
    && ${ROCKS_INSTALLER} install connpool $LUAROCK_CONNPOOL_VERSION \
208
    && : "vshard" \
209
    && ${ROCKS_INSTALLER} install vshard $LUAROCK_VSHARD_VERSION \
210
    && : "http" \
211
    && ${ROCKS_INSTALLER} install http $LUAROCK_HTTP_VERSION \
212
    && : "pg" \
213
    && ${ROCKS_INSTALLER} install pg $LUAROCK_TARANTOOL_PG_VERSION \
214
    && : "mysql" \
215
    && ${ROCKS_INSTALLER} install mysql $LUAROCK_TARANTOOL_MYSQL_VERSION \
216
    && : "memcached" \
217
    && ${ROCKS_INSTALLER} install memcached $LUAROCK_MEMCACHED_VERSION \
218
    && : "metrics" \
219
    && ${ROCKS_INSTALLER} install metrics $LUAROCK_METRICS_VERSION \
220
    && : "prometheus" \
221
    && ${ROCKS_INSTALLER} install prometheus $LUAROCK_TARANTOOL_PROMETHEUS_VERSION \
222
    && : "mqtt" \
223
    && ${ROCKS_INSTALLER} install mqtt $LUAROCK_TARANTOOL_MQTT_VERSION \
224
    && : "gis" \
225
    && ${ROCKS_INSTALLER} install gis $LUAROCK_TARANTOOL_GIS_VERSION \
226
    && : "gperftools" \
227
    && ${ROCKS_INSTALLER} install gperftools $LUAROCK_TARANTOOL_GPERFTOOLS_VERSION \
228
    && : "---------- remove build deps ----------" \
229
    && apk del .build-deps.2
230

231
# gh-170: needed for luarocks
232
RUN apk update \
233
    && apk add wget git
234

235
RUN mkdir -p /var/lib/tarantool \
236
    && chown tarantool:tarantool /var/lib/tarantool \
237
    && mkdir -p /opt/tarantool \
238
    && chown tarantool:tarantool /opt/tarantool \
239
    && mkdir -p /var/run/tarantool \
240
    && chown tarantool:tarantool /var/run/tarantool \
241
    && mkdir /etc/tarantool \
242
    && chown tarantool:tarantool /etc/tarantool
243

244
VOLUME /var/lib/tarantool
245
WORKDIR /opt/tarantool
246

247
COPY files/tarantool-entrypoint.lua /usr/local/bin/
248
COPY files/tarantool_set_config.lua /usr/local/bin/
249
COPY files/docker-entrypoint.sh /usr/local/bin/
250
COPY files/console /usr/local/bin/
251
COPY files/tarantool_is_up /usr/local/bin/
252
COPY files/tarantool.default /usr/local/etc/default/tarantool
253

254
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
255
ENTRYPOINT ["docker-entrypoint.sh"]
256

257
HEALTHCHECK CMD tarantool_is_up
258

259
EXPOSE 3301
260
CMD [ "tarantool" ]
261

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.