Skip to content

Commit 3c00b0a

Browse files
committed
增加自动打包
1 parent 514f6ed commit 3c00b0a

File tree

2 files changed

+55
-21
lines changed

2 files changed

+55
-21
lines changed

.github/workflows/docker-publish.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 参考
2+
# Build and push Docker images
3+
# https://github.com/marketplace/actions/build-and-push-docker-images
4+
# Docker Metadata action
5+
# https://github.com/marketplace/actions/docker-metadata-action
6+
# Multi-platform image with GitHub Actions
7+
# https://docs.docker.com/build/ci/github-actions/multi-platform/
8+
9+
name: Docker Publish
10+
11+
on:
12+
push:
13+
branches:
14+
- master
15+
16+
env:
17+
IMAGE_NAME: "buyfakett/openresty"
18+
IMAGE_TAG: "ubuntu_focal-ngx_waf"
19+
20+
jobs:
21+
docker:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
30+
- name: Docker meta
31+
id: meta
32+
uses: docker/metadata-action@v4
33+
with:
34+
images: ${{ env.IMAGE_NAME }}
35+
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v2
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Build Docker Image
43+
uses: docker/build-push-action@v2
44+
with:
45+
context: .
46+
platforms: linux/amd64
47+
push: true
48+
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

Dockerfile

+7-21
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
ARG RESTY_IMAGE_BASE="ubuntu"
55
ARG RESTY_IMAGE_TAG="focal"
6-
ARG LIB_SODIUM_VER=1.0.18-RELEASE
76

87
FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
98

@@ -12,15 +11,15 @@ LABEL maintainer="Evan Wies <evan@neomantra.net>"
1211
# Docker Build Arguments
1312
ARG RESTY_IMAGE_BASE="ubuntu"
1413
ARG RESTY_IMAGE_TAG="focal"
15-
ARG RESTY_VERSION="1.25.3.1"
14+
ARG RESTY_VERSION="1.25.3.2"
1615
ARG RESTY_LUAROCKS_VERSION="3.11.0"
1716
ARG RESTY_OPENSSL_VERSION="1.1.1w"
1817
ARG RESTY_OPENSSL_PATCH_VERSION="1.1.1f"
1918
ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source/old/1.1.1"
2019
ARG RESTY_PCRE_VERSION="8.45"
2120
ARG RESTY_PCRE_BUILD_OPTIONS="--enable-jit"
2221
ARG RESTY_PCRE_SHA256="4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09"
23-
ARG RESTY_J="1"
22+
ARG RESTY_J="2"
2423
ARG RESTY_CONFIG_OPTIONS="\
2524
--with-compat \
2625
--with-file-aio \
@@ -41,6 +40,7 @@ ARG RESTY_CONFIG_OPTIONS="\
4140
--with-http_stub_status_module \
4241
--with-http_sub_module \
4342
--with-http_v2_module \
43+
--with-http_v3_module \
4444
--with-http_xslt_module=dynamic \
4545
--with-ipv6 \
4646
--with-mail \
@@ -50,9 +50,9 @@ ARG RESTY_CONFIG_OPTIONS="\
5050
--with-stream \
5151
--with-stream_ssl_module \
5252
--with-threads \
53-
--with-cc-opt='-fstack-protector-strong' \
53+
--add-module=/usr/local/src/ngx_waf \
5454
"
55-
ARG RESTY_CONFIG_OPTIONS_MORE="--add-module=/tmp/ngx_waf"
55+
ARG RESTY_CONFIG_OPTIONS_MORE=""
5656
ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'"
5757
ARG RESTY_PCRE_OPTIONS="--with-pcre-jit"
5858

@@ -89,11 +89,10 @@ LABEL resty_eval_post_make="${RESTY_EVAL_POST_MAKE}"
8989
LABEL resty_luajit_options="${RESTY_LUAJIT_OPTIONS}"
9090
LABEL resty_pcre_options="${RESTY_PCRE_OPTIONS}"
9191

92-
COPY ./ngx_waf /tmp/ngx_waf
92+
COPY ngx_waf /usr/local/src/ngx_waf
9393

9494
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
9595
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
96-
git \
9796
build-essential \
9897
ca-certificates \
9998
curl \
@@ -109,19 +108,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
109108
unzip \
110109
wget \
111110
zlib1g-dev \
112-
libcurl4-openssl-dev \
113-
libmodsecurity-dev \
114-
libmodsecurity3 \
115111
${RESTY_ADD_PACKAGE_BUILDDEPS} \
116112
${RESTY_ADD_PACKAGE_RUNDEPS} \
117-
&& git clone -b v1.7.15 https://github.com/DaveGamble/cJSON.git /tmp/ngx_waf/lib/cjson \
118-
&& git clone -b v2.3.0 https://github.com/troydhanson/uthash.git /tmp/ngx_waf/lib/uthash \
119-
&& git clone https://github.com/jedisct1/libsodium.git --branch 1.0.18-RELEASE /tmp/libsodium \
120-
&& cd /tmp/libsodium \
121-
&& ./configure --prefix=/usr/local/libsodium --with-pic \
122-
&& make \
123-
&& make check \
124-
&& make install \
125113
&& cd /tmp \
126114
&& if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \
127115
&& curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
@@ -161,7 +149,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
161149
&& curl -fSL https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz -o openresty-${RESTY_VERSION}.tar.gz \
162150
&& tar xzf openresty-${RESTY_VERSION}.tar.gz \
163151
&& cd /tmp/openresty-${RESTY_VERSION} \
164-
&& export LIB_SODIUM=/usr/local/libsodium \
165152
&& if [ -n "${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}); fi \
166153
&& eval ./configure -j${RESTY_J} ${_RESTY_CONFIG_DEPS} ${RESTY_CONFIG_OPTIONS} ${RESTY_CONFIG_OPTIONS_MORE} ${RESTY_LUAJIT_OPTIONS} ${RESTY_PCRE_OPTIONS} \
167154
&& make -j${RESTY_J} \
@@ -177,7 +164,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
177164
&& ./configure \
178165
--prefix=/usr/local/openresty/luajit \
179166
--with-lua=/usr/local/openresty/luajit \
180-
--lua-suffix=jit-2.1.0-beta3 \
181167
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
182168
&& make build \
183169
&& make install \
@@ -197,7 +183,7 @@ ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/
197183
# If OpenResty changes, these may need updating:
198184
# /usr/local/openresty/bin/resty -e 'print(package.path)'
199185
# /usr/local/openresty/bin/resty -e 'print(package.cpath)'
200-
ENV LUA_PATH="/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua"
186+
ENV LUA_PATH="/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua"
201187

202188
ENV LUA_CPATH="/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so"
203189

0 commit comments

Comments
 (0)