Skip to content

Commit

Permalink
Merge pull request #85 from sitkoru/upd
Browse files Browse the repository at this point in the history
feat: upd nginx to 1.24.0
  • Loading branch information
SonicGD authored Jun 16, 2023
2 parents c3c1008 + 3fed128 commit a976460
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 37 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
Expand Down Expand Up @@ -44,32 +44,21 @@ jobs:
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
driver-opts: image=moby/buildkit:master
- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
username: ${{ secrets.BOT_NAME }}
password: ${{ secrets.BOT_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: ${{ steps.prep.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
Expand Down
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
FROM nginx:1.19.3
FROM nginx:1.24.0 as build

ENV NGINX_VERSION 1.19.3
ENV NPS_VERSION 36
ENV NPSOL_VERSION 1.13.35.2-stable
ENV OSSL_VERSION 1.1.1g
ENV CODENAME buster
ENV VTS_VERSION=0.1.18
ENV CODENAME bullseye
ENV NGINX_VERSION 1.24.0

RUN apt-get update \
&& apt-get install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip wget libcurl4-openssl-dev libjansson-dev uuid-dev libbrotli-dev
&& apt-get install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip wget libcurl4-openssl-dev libjansson-dev uuid-dev libbrotli-dev git

RUN wget http://nginx.org/keys/nginx_signing.key \
&& apt-key add nginx_signing.key \
&& echo "deb http://nginx.org/packages/mainline/debian/ ${CODENAME} nginx" >> /etc/apt/sources.list \
&& echo "deb-src http://nginx.org/packages/mainline/debian/ ${CODENAME} nginx" >> /etc/apt/sources.list \
&& echo "deb http://nginx.org/packages/debian/ ${CODENAME} nginx" >> /etc/apt/sources.list \
&& echo "deb-src http://nginx.org/packages/debian/ ${CODENAME} nginx" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get build-dep -y nginx=${NGINX_VERSION}-1

WORKDIR /nginx

ENV NPSOL_VERSION focal
ENV OSSL_VERSION 1.1.1g
ENV VTS_VERSION=0.1.18

ADD ./build.sh build.sh

RUN chmod a+x ./build.sh && ./build.sh
RUN apt-get download libbrotli1


FROM nginx:1.19.3
COPY --from=0 /nginx/nginx_1.19.3-1~buster_amd64.deb /nginx/libbrotli1*.deb /_pkgs/
FROM nginx:1.24.0 as publish
COPY --from=build /nginx/nginx_1.24.0-1~bullseye_amd64.deb /nginx/libbrotli1*.deb /_pkgs/
RUN dpkg --install /_pkgs/*.deb && rm -rf /_pkgs
14 changes: 6 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ apt-get source nginx=${NGINX_VERSION}-1
mkdir -p nginx-${NGINX_VERSION}/debian/modules
cd nginx-${NGINX_VERSION}/debian/modules

wget https://github.com/apache/incubator-pagespeed-ngx/archive/${NPS_VERSION}.zip -O release-${NPS_VERSION}.zip
unzip release-${NPS_VERSION}.zip
cd incubator-pagespeed-ngx-${NPS_VERSION}/
psol_url=https://dl.google.com/dl/page-speed/psol/${NPSOL_VERSION}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url})
# https://github.com/apache/incubator-pagespeed-ngx/issues/1760
git clone --depth=1 https://github.com/apache/incubator-pagespeed-ngx.git
wget http://www.tiredofit.nl/psol-${NPSOL_VERSION}.tar.xz
tar xvf psol-${NPSOL_VERSION}.tar.xz
mv psol incubator-pagespeed-ngx

cd /nginx/nginx-${NGINX_VERSION}
wget https://www.openssl.org/source/openssl-${OSSL_VERSION}.tar.gz
Expand All @@ -24,7 +22,7 @@ tar -xf brotli.tar.gz
wget -O vts.tar.gz https://github.com/vozlt/nginx-module-vts/archive/v${VTS_VERSION}.tar.gz
tar -xf vts.tar.gz

sed -i "0,/CFLAGS\=\\\"\\\"/{/CFLAGS\=\\\"\\\"/ s/$/ --add-module=\/nginx\/nginx-${NGINX_VERSION}\/debian\/modules\/incubator-pagespeed-ngx-${NPS_VERSION} ${PS_NGX_EXTRA_FLAGS} --add-module=\/nginx\/nginx-${NGINX_VERSION}\/ngx_brotli-master --add-module=\/nginx\/nginx-${NGINX_VERSION}\/nginx-module-vts-${VTS_VERSION} --with-openssl=\/nginx\/nginx-${NGINX_VERSION}\/openssl-${OSSL_VERSION}/}" /nginx/nginx-${NGINX_VERSION}/debian/rules
sed -i "0,/CFLAGS\=\\\"\\\"/{/CFLAGS\=\\\"\\\"/ s/$/ --add-module=\/nginx\/nginx-${NGINX_VERSION}\/debian\/modules\/incubator-pagespeed-ngx ${PS_NGX_EXTRA_FLAGS} --add-module=\/nginx\/nginx-${NGINX_VERSION}\/ngx_brotli-master --add-module=\/nginx\/nginx-${NGINX_VERSION}\/nginx-module-vts-${VTS_VERSION} --with-openssl=\/nginx\/nginx-${NGINX_VERSION}\/openssl-${OSSL_VERSION}/}" /nginx/nginx-${NGINX_VERSION}/debian/rules
sed -i "s/CFLAGS\=\\\"\\\"/CFLAGS\=\\\"-Wno-missing-field-initializers\\\"/" /nginx/nginx-${NGINX_VERSION}/debian/rules

dpkg-buildpackage -b

0 comments on commit a976460

Please sign in to comment.