This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix-docker.git
The following commit(s) were added to refs/heads/master by this push: new da37a28 updated 1.2 version for alpine (#45) da37a28 is described below commit da37a28c37d730322a0a342e580642ff1a8e0b38 Author: wonglend <gk...@qq.com> AuthorDate: Tue Apr 28 16:12:41 2020 +0800 updated 1.2 version for alpine (#45) --- alpine/Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++------ alpine/hooks/build | 5 +++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/alpine/Dockerfile b/alpine/Dockerfile index e548fbf..ad4c243 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -1,9 +1,25 @@ - FROM openresty/openresty:alpine-fat +FROM node:10-alpine3.11 AS build-stage + +ARG APISIX_VERSION=1.1 + +RUN set -x \ + && /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories \ + && apk add --no-cache --virtual .build-deps git \ + && git clone -b ${APISIX_VERSION} https://github.com/apache/incubator-apisix.git /tmp/apisix \ + && cd /tmp/apisix \ + && git submodule init \ + && git submodule update \ + && cd dashboard \ + && yarn && yarn build:prod + +FROM openresty/openresty:alpine-fat AS production-stage ARG APISIX_VERSION=1.1 LABEL apisix_version="${APISIX_VERSION}" -RUN apk add --no-cache --virtual .builddeps \ +RUN set -x \ + && /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories \ + && apk add --no-cache --virtual .builddeps \ automake \ autoconf \ libtool \ @@ -11,14 +27,31 @@ RUN apk add --no-cache --virtual .builddeps \ cmake \ git \ && luarocks install https://github.com/apache/incubator-apisix/raw/master/rockspec/apisix-${APISIX_VERSION}-0.rockspec --tree=/usr/local/apisix/deps \ - && cp /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ - && bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/lua/?.lua;" .. package.path' \ + && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ + && bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path' \ && sed -i "1s@.*@$bin@" /usr/bin/apisix \ - && mv /usr/local/apisix/deps/share/lua/5.1/apisix/lua /usr/local/apisix \ - && apk del .builddeps + && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \ + && apk del .builddeps build-base make unzip + +FROM alpine:3.11 AS last-stage + +# add runtime for Apache APISIX +RUN set -x \ + && /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories \ + && apk add --no-cache bash libstdc++ curl WORKDIR /usr/local/apisix +COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/ +COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/ +COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix + +COPY --from=build-stage /tmp/apisix/dashboard/dist/ /usr/local/apisix/dashboard/ + +ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin + 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;'"] + +STOPSIGNAL SIGQUIT diff --git a/alpine/hooks/build b/alpine/hooks/build new file mode 100644 index 0000000..256780d --- /dev/null +++ b/alpine/hooks/build @@ -0,0 +1,5 @@ +#!/bin/bash +# hooks/build +# https://docs.docker.com/docker-cloud/builds/advanced/ + +docker build --build-arg APISIX_VERSION=$APISIX_VERSION -t $IMAGE_NAME:${APISIX_VERSION}-alpine .