-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: build apisix-openresty base on alpine #97
Open
gxthrj
wants to merge
30
commits into
api7:master
Choose a base branch
from
gxthrj:openresty/alpine
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+241
−13
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0306832
feat: build apisix-openresty base on alpine
gxthrj 07c4293
fix
gxthrj 3c45b07
fix: add bash
gxthrj 2ed1229
add git
gxthrj 24dcd77
debug dockerfile
gxthrj ca872bc
add curl
gxthrj c43dbc7
debug: curl version
gxthrj 268de16
debug: add or_prefix
gxthrj 6e4c699
debug
gxthrj abc71c9
debug
gxthrj bc258fa
add sudo
gxthrj a71ff23
only openssl111
gxthrj 32bc2ec
fix
gxthrj 48b4801
add apisix-alpine build script
gxthrj 97f7b94
fix: the image name of apisix-openresty which is based by apisix-alpine
gxthrj 7ac1672
remove unused arg/labels
gxthrj d9280f2
merge master
gxthrj dfa65e0
rename apisix-openresty to apisix-base
gxthrj e4e09b1
modify makefile
gxthrj 11bf9ae
modify makefile
gxthrj d46c95a
rename apisix-base
gxthrj 8a180f2
add build-base in alpine
gxthrj e81352b
add g++
gxthrj 0a10d68
add libc6-compat
gxthrj c257660
use alpine-pkg-glibc
gxthrj 553a62a
add alpine apisix-base workflow
gxthrj 48880ac
modify name
gxthrj 86ae9d2
test
gxthrj 83a5201
reset build-apisix-base.sh
gxthrj 41a26f1
test
gxthrj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: package apisix-base apk | ||
|
||
on: | ||
push: | ||
branches: [ openresty/* ] | ||
tags: | ||
- "v*" | ||
paths-ignore: | ||
- '*.md' | ||
pull_request: | ||
branches: [ master ] | ||
paths-ignore: | ||
- '*.md' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILD_APISIX_BASE_VERSION: 1.19.3.2.0 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: install dependencies | ||
run: | | ||
sudo apt-get install -y make ruby ruby-dev rubygems build-essential | ||
|
||
- name: build apisix-base apk | ||
run: | | ||
make package version=${BUILD_APISIX_BASE_VERSION} image_base=alpine image_tag=3.12 app=apisix-base type=apk |
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 @@ | ||
.idea |
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,95 @@ | ||
ARG IMAGE_BASE="alpine" | ||
ARG IMAGE_TAG="3.12" | ||
|
||
FROM ${IMAGE_BASE}:${IMAGE_TAG} | ||
|
||
COPY ./utils/build-common.sh /tmp/build-common.sh | ||
COPY build-apisix-base.sh /tmp/build-apisix-base.sh | ||
COPY ./utils/determine-dist.sh /tmp/determine-dist.sh | ||
|
||
|
||
ARG RESTY_OPENSSL_VERSION="1.1.1g" | ||
ARG RESTY_OPENSSL_PATCH_VERSION="1.1.1f" | ||
ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source" | ||
ARG RESTY_PCRE_VERSION="8.44" | ||
ARG RESTY_J="1" | ||
ARG RESTY_EVAL_PRE_CONFIGURE="" | ||
ARG VERSION | ||
|
||
LABEL resty_image_base="${RESTY_IMAGE_BASE}" | ||
LABEL resty_image_tag="${IMAGE_TAG}" | ||
LABEL resty_openssl_version="${RESTY_OPENSSL_VERSION}" | ||
LABEL resty_openssl_patch_version="${RESTY_OPENSSL_PATCH_VERSION}" | ||
LABEL resty_openssl_url_base="${RESTY_OPENSSL_URL_BASE}" | ||
LABEL resty_pcre_version="${RESTY_PCRE_VERSION}" | ||
LABEL resty_eval_pre_configure="${RESTY_EVAL_PRE_CONFIGURE}" | ||
|
||
|
||
RUN apk add --no-cache --virtual .build-deps \ | ||
build-base \ | ||
coreutils \ | ||
curl \ | ||
gd-dev \ | ||
geoip-dev \ | ||
libxslt-dev \ | ||
linux-headers \ | ||
make \ | ||
perl-dev \ | ||
readline-dev \ | ||
zlib-dev \ | ||
&& apk add --no-cache \ | ||
gd \ | ||
geoip \ | ||
libxslt \ | ||
zlib \ | ||
bash \ | ||
git \ | ||
sudo \ | ||
curl \ | ||
build-base \ | ||
libstdc++ | ||
|
||
# install latest Rust to build wasmtime | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-installer.sh \ | ||
&& chmod +x ./rust-installer.sh \ | ||
&& ./rust-installer.sh -y \ | ||
&& rm rust-installer.sh | ||
|
||
RUN cd /tmp \ | ||
&& if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ | ||
&& cd /tmp \ | ||
&& curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \ | ||
&& tar xzf openssl-${RESTY_OPENSSL_VERSION}.tar.gz \ | ||
&& cd openssl-${RESTY_OPENSSL_VERSION} \ | ||
&& echo 'patching OpenSSL 1.1.1 for OpenResty' \ | ||
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 \ | ||
&& ./config \ | ||
no-threads shared zlib -g \ | ||
enable-ssl3 enable-ssl3-method \ | ||
--prefix=/usr/local/openresty/openssl111 \ | ||
--libdir=lib \ | ||
-Wl,-rpath,/usr/local/openresty/openssl111/lib \ | ||
&& make -j${RESTY_J} \ | ||
&& make -j${RESTY_J} install_sw | ||
|
||
RUN cd /tmp \ | ||
&& curl -fSL https://ftp.pcre.org/pub/pcre/pcre-${RESTY_PCRE_VERSION}.tar.gz -o pcre-${RESTY_PCRE_VERSION}.tar.gz \ | ||
&& tar xzf pcre-${RESTY_PCRE_VERSION}.tar.gz \ | ||
&& cd /tmp/pcre-${RESTY_PCRE_VERSION} \ | ||
&& ./configure \ | ||
--prefix=/usr/local/openresty/pcre \ | ||
--disable-cpp \ | ||
--enable-jit \ | ||
--enable-utf \ | ||
--enable-unicode-properties \ | ||
&& make -j${RESTY_J} \ | ||
&& make -j${RESTY_J} install | ||
|
||
ENV version=${VERSION} | ||
RUN cd /tmp \ | ||
&& curl --version \ | ||
&& source /root/.cargo/env \ | ||
&& ./build-common.sh build_apisix_base_apk \ | ||
&& /usr/local/openresty/bin/openresty -V | ||
|
||
CMD /bin/sh |
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,55 @@ | ||
ARG ENABLE_PROXY=false | ||
ARG OPENRESTY_VERSION | ||
ARG OPENRESTY_NAME | ||
|
||
FROM apache/${OPENRESTY_NAME}:${OPENRESTY_VERSION} AS production-stage | ||
|
||
ARG APISIX_VERSION=2.9 | ||
LABEL apisix_version="${APISIX_VERSION}" | ||
|
||
ARG ENABLE_PROXY | ||
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 \ | ||
pcre \ | ||
pcre-dev \ | ||
&& mkdir ~/.luarocks \ | ||
&& luarocks config variables.OPENSSL_LIBDIR /usr/local/openresty/openssl/lib \ | ||
&& luarocks config variables.OPENSSL_INCDIR /usr/local/openresty/openssl/include \ | ||
&& luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-${APISIX_VERSION}-0.rockspec --tree=/usr/local/apisix/deps \ | ||
&& cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ | ||
&& (if [ "$APISIX_VERSION" = "master" ] || [ "$APISIX_VERSION" \> "2.2" ]; then echo 'use shell ';else bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'; sed -i "1s@.*@$bin@" /usr/bin/apisix ; fi;) \ | ||
&& mv /usr/local/apisix/deps/share/lua/5.1/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 libstdc++ curl 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 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be removed?