forked from apache/apisix-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (63 loc) · 2.46 KB
/
Dockerfile
File metadata and controls
69 lines (63 loc) · 2.46 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
ARG RESTY_IMAGE_BASE="openresty/openresty"
ARG RESTY_IMAGE_TAG="alpine-fat"
# require alpine-fat >= 1.15.8.1-3
FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
MAINTAINER vkill <vkill.net@gmail.com>
#
# docker build -t apisix:v0.5-alpine -f alpine/Dockerfile alpine
# docker build -t apisix:dev-alpine --build-arg APISIX_VERSION=master --build-arg APISIX_DOWNLOAD_SHA256=SKIP -f alpine/Dockerfile alpine
# docker build -t apisix:my-alpine --build-arg APISIX_GITHUB_REPO=https://github.com/YOU/apisix --build-arg APISIX_VERSION=BRANCHNAME --build-arg APISIX_DOWNLOAD_SHA256=SKIP -f alpine/Dockerfile alpine
#
ARG APISIX_VERSION=v0.5
ENV APISIX_VERSION=${APISIX_VERSION}
ARG APISIX_GITHUB_REPO=https://github.com/iresty/apisix
ENV APISIX_DOWNLOAD_URL ${APISIX_GITHUB_REPO}/archive/${APISIX_VERSION}.zip
ARG APISIX_DOWNLOAD_SHA256=e6f14dcd58c5ba286ee48f8482a669893560bc2fbc90d6bf52881493ce720fb7
ENV APISIX_DOWNLOAD_SHA256=${APISIX_DOWNLOAD_SHA256}
RUN set -ex \
\
# && sed -i 's!dl-cdn.alpinelinux.org!mirrors.aliyun.com!' /etc/apk/repositories \
\
&& apk add --no-cache --virtual .rundeps \
curl \
\
&& apk add --no-cache --virtual .builddeps \
unzip \
build-base \
make \
sudo \
git \
automake \
autoconf \
libtool \
pkgconfig \
cmake \
\
&& ln -sf /usr/local/openresty/luajit/bin/luajit /usr/bin/lua \
&& mkdir -p /usr/local/lib/pkgconfig \
&& mkdir -p /usr/local/include \
&& ln -sf /usr/local/openresty/pcre/lib/libpcre.so /usr/local/lib/libpcre.so \
&& ln -sf /usr/local/openresty/pcre/lib/pkgconfig/libpcre.pc /usr/local/lib/pkgconfig/libpcre.pc \
&& ln -sf /usr/local/openresty/pcre/include/pcre.h /usr/local/include/pcre.h \
\
&& wget -O apisix.zip "${APISIX_DOWNLOAD_URL}" \
&& [[ "${APISIX_DOWNLOAD_SHA256}" = "SKIP" ]] && echo "SKIP" || (echo "${APISIX_DOWNLOAD_SHA256} *apisix.zip" | sha256sum -c -) \
\
&& mkdir -p /usr/src \
&& unzip apisix.zip -d /usr/src \
&& rm apisix.zip \
\
&& cd "/usr/src/apisix-`echo ${APISIX_VERSION} | sed 's/^v//'`" \
\
&& make dev \
&& make install \
&& cp -r deps /usr/local/apisix/ \
&& sed -i '/pcall(require, "cjson")$/,/^end$/s/return$/-- return/' /usr/bin/apisix \
\
&& cd / \
&& rm -r "/usr/src/apisix-`echo ${APISIX_VERSION} | sed 's/^v//'`" \
\
&& apk del .builddeps
WORKDIR /usr/local/apisix
EXPOSE 9080 9443
CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"]