-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
- Loading branch information
1 parent
7188acb
commit 9309c75
Showing
4 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ARG ENABLE_PROXY=false | ||
|
||
FROM openresty/openresty:1.19.3.2-alpine-fat AS production-stage | ||
|
||
ARG ENABLE_PROXY | ||
ARG APISIX_PATH | ||
COPY $APISIX_PATH ./apisix | ||
RUN set -x \ | ||
&& (test "${ENABLE_PROXY}" != "true" || /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 \ | ||
pkgconfig \ | ||
cmake \ | ||
git \ | ||
openldap-dev \ | ||
&& cd apisix \ | ||
&& git config --global url.https://github.com/.insteadOf git://github.com/ \ | ||
&& mkdir -p ~/.luarocks \ | ||
&& luarocks config --local variable.PCRE_DIR /usr/local/openresty/pcre/ \ | ||
&& make deps \ | ||
&& cp -v bin/apisix /usr/bin/ \ | ||
&& mv ../apisix /usr/local/apisix \ | ||
&& apk del .builddeps build-base make unzip | ||
|
||
FROM alpine:3.13 AS last-stage | ||
|
||
ARG ENABLE_PROXY | ||
# add runtime for Apache APISIX | ||
RUN set -x \ | ||
&& (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ | ||
&& apk add --no-cache \ | ||
bash \ | ||
curl \ | ||
libstdc++ \ | ||
openldap \ | ||
tzdata | ||
|
||
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 | ||
|
||
# forward request and error logs to docker log collector | ||
RUN mkdir -p logs && touch logs/access.log && touch logs/error.log \ | ||
&& ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ | ||
&& ln -sf /dev/stderr /usr/local/apisix/logs/error.log | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters