|
| 1 | +ARG RESTY_IMAGE_BASE="openresty/openresty" |
| 2 | +ARG RESTY_IMAGE_TAG="alpine-fat" |
| 3 | +# require alpine-fat >= 1.15.8.1-3 |
| 4 | +FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} |
| 5 | + |
| 6 | +MAINTAINER vkill < [email protected]> |
| 7 | + |
| 8 | +# |
| 9 | +# docker build -t apisix:v0.5-alpine -f alpine/Dockerfile alpine |
| 10 | +# docker build -t apisix:dev-alpine --build-arg APISIX_VERSION=master --build-arg APISIX_DOWNLOAD_SHA256=SKIP -f alpine/Dockerfile alpine |
| 11 | +# 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 |
| 12 | +# |
| 13 | +ARG APISIX_VERSION=v0.5 |
| 14 | +ENV APISIX_VERSION=${APISIX_VERSION} |
| 15 | +ARG APISIX_GITHUB_REPO=https://github.com/iresty/apisix |
| 16 | +ENV APISIX_DOWNLOAD_URL ${APISIX_GITHUB_REPO}/archive/${APISIX_VERSION}.zip |
| 17 | +ARG APISIX_DOWNLOAD_SHA256=e6f14dcd58c5ba286ee48f8482a669893560bc2fbc90d6bf52881493ce720fb7 |
| 18 | +ENV APISIX_DOWNLOAD_SHA256=${APISIX_DOWNLOAD_SHA256} |
| 19 | + |
| 20 | +RUN set -ex \ |
| 21 | + \ |
| 22 | + # && sed -i 's!dl-cdn.alpinelinux.org!mirrors.aliyun.com!' /etc/apk/repositories \ |
| 23 | + \ |
| 24 | + && apk add --no-cache --virtual .rundeps \ |
| 25 | + curl \ |
| 26 | + \ |
| 27 | + && apk add --no-cache --virtual .builddeps \ |
| 28 | + unzip \ |
| 29 | + build-base \ |
| 30 | + make \ |
| 31 | + sudo \ |
| 32 | + git \ |
| 33 | + automake \ |
| 34 | + autoconf \ |
| 35 | + libtool \ |
| 36 | + pkgconfig \ |
| 37 | + cmake \ |
| 38 | + \ |
| 39 | + && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/bin/lua \ |
| 40 | + && mkdir -p /usr/local/lib/pkgconfig \ |
| 41 | + && mkdir -p /usr/local/include \ |
| 42 | + && ln -sf /usr/local/openresty/pcre/lib/libpcre.so /usr/local/lib/libpcre.so \ |
| 43 | + && ln -sf /usr/local/openresty/pcre/lib/pkgconfig/libpcre.pc /usr/local/lib/pkgconfig/libpcre.pc \ |
| 44 | + && ln -sf /usr/local/openresty/pcre/include/pcre.h /usr/local/include/pcre.h \ |
| 45 | + \ |
| 46 | + && wget -O apisix.zip "${APISIX_DOWNLOAD_URL}" \ |
| 47 | + && [[ "${APISIX_DOWNLOAD_SHA256}" = "SKIP" ]] && echo "SKIP" || (echo "${APISIX_DOWNLOAD_SHA256} *apisix.zip" | sha256sum -c -) \ |
| 48 | + \ |
| 49 | + && mkdir -p /usr/src \ |
| 50 | + && unzip apisix.zip -d /usr/src \ |
| 51 | + && rm apisix.zip \ |
| 52 | + \ |
| 53 | + && cd "/usr/src/apisix-`echo ${APISIX_VERSION} | sed 's/^v//'`" \ |
| 54 | + \ |
| 55 | + && make dev \ |
| 56 | + && make install \ |
| 57 | + && cp -r deps /usr/local/apisix/ \ |
| 58 | + && sed -i '/pcall(require, "cjson")$/,/^end$/s/return$/-- return/' /usr/bin/apisix \ |
| 59 | + \ |
| 60 | + && cd / \ |
| 61 | + && rm -r "/usr/src/apisix-`echo ${APISIX_VERSION} | sed 's/^v//'`" \ |
| 62 | + \ |
| 63 | + && apk del .builddeps |
| 64 | + |
| 65 | +WORKDIR /usr/local/apisix |
| 66 | + |
| 67 | +EXPOSE 9080 9443 |
| 68 | + |
| 69 | +CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"] |
0 commit comments