diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2001000..c0ebb31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: | @@ -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/setup-buildx-action@v1.6.0 - with: - driver-opts: image=moby/buildkit:master - - name: Cache Docker layers - uses: actions/cache@v2.1.6 - 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 }} diff --git a/Dockerfile b/Dockerfile index 1fdabee..786506d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/build.sh b/build.sh index f5cd34c..1e7c987 100644 --- a/build.sh +++ b/build.sh @@ -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 @@ -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