-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move binaries build to GitHub Actions
- Loading branch information
Showing
2 changed files
with
124 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: ${{ github.ref_name }}-ci | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-binaries: | ||
name: Build Docker Image | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
nginx_version: [1.25.0, 1.25.1, 1.25.2, 1.25.3] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build binary | ||
uses: docker/build-push-action@v5 | ||
with: | ||
pull: true | ||
load: true | ||
push: false | ||
file: build/Dockerfile | ||
tags: ${{ matrix.nginx_version }} | ||
cache-from: type=gha,scope=${{ matrix.nginx_version }} | ||
cache-to: type=gha,scope=${{ matrix.nginx_version }},mode=max | ||
target: final | ||
build-args: NGINX_VERSIONS=${{ matrix.nginx_version }} | ||
outputs: type=tar,dest=linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.tar | ||
|
||
- name: Compress tar | ||
run: | | ||
gzip -9 linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.tar | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.tgz | ||
path: linux-amd64-nginx-${{ matrix.nginx_version }}-ngx_http_module.so.tar.gz |
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,71 @@ | ||
FROM ubuntu:23.10 as base | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends --no-install-suggests -y \ | ||
build-essential \ | ||
cmake \ | ||
pkg-config \ | ||
git \ | ||
ca-certificates \ | ||
automake \ | ||
autogen \ | ||
autoconf \ | ||
libtool \ | ||
ssh \ | ||
wget \ | ||
libpcre3 libpcre3-dev \ | ||
zlib1g-dev | ||
|
||
|
||
FROM base as opentracing | ||
ARG OPENTRACING_VERSION=v1.6.0 | ||
|
||
RUN <<"eot" bash -euo pipefail | ||
git clone -b "${OPENTRACING_VERSION}" https://github.com/opentracing/opentracing-cpp.git | ||
cd opentracing-cpp | ||
mkdir .build && cd .build | ||
cmake -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_CXX_FLAGS="-fPIC" \ | ||
-DBUILD_SHARED_LIBS=OFF \ | ||
-DBUILD_TESTING=OFF \ | ||
-DBUILD_MOCKTRACER=OFF \ | ||
.. | ||
make && make install | ||
eot | ||
|
||
FROM opentracing as binary | ||
ARG NGINX_VERSION | ||
|
||
COPY --link opentracing /opentracing | ||
|
||
ADD --link https://github.com/nginx/nginx/archive/release-${NGINX_VERSION}.tar.gz / | ||
|
||
RUN tar zxf release-${NGINX_VERSION}.tar.gz | ||
|
||
WORKDIR /nginx-release-${NGINX_VERSION} | ||
|
||
COPY <<-EOT export.map | ||
{ | ||
global: | ||
ngx_*; | ||
local: *; | ||
}; | ||
EOT | ||
|
||
RUN ./auto/configure \ | ||
--with-compat \ | ||
--add-dynamic-module=/opentracing \ | ||
&& make modules | ||
|
||
RUN /usr/bin/g++ -o ngx_http_opentracing_module.so \ | ||
objs/addon/src/*.o \ | ||
objs/ngx_http_opentracing_module_modules.o \ | ||
-static-libstdc++ -static-libgcc \ | ||
-lopentracing \ | ||
-Wl,--version-script="export.map" \ | ||
-shared | ||
|
||
|
||
FROM scratch as export | ||
ARG NGINX_VERSION | ||
COPY --from=binary /nginx-release-${NGINX_VERSION}/ngx_http_opentracing_module.so / |