Skip to content

Commit 9b7541c

Browse files
committed
.
1 parent a69daa4 commit 9b7541c

6 files changed

Lines changed: 113 additions & 191 deletions

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ jobs:
8888
push: ${{ github.event_name != 'pull_request' }}
8989
tags: ${{ steps.meta.outputs.tags }}
9090
labels: ${{ steps.meta.outputs.labels }}
91-
platforms: linux/arm64, linux/arm/v7
92-
#cache-from: type=gha
93-
#cache-to: type=gha,mode=max
91+
platforms: linux/amd64, linux/arm64, linux/arm/v7
92+
cache-from: type=gha
93+
cache-to: type=gha,mode=max
9494

9595
# Sign the resulting Docker image digest except on PRs.
9696
# This will only write to the public Rekor transparency log when the Docker

Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ RUN apt update && \
66
libncurses5-dev libgdbm-dev \
77
libnss3-dev libssl-dev \
88
libreadline-dev libffi-dev ca-certificates \
9-
pkg-config wget git curl unzip lsb-release rsync sudo libjemalloc-dev gperf && \
9+
pkg-config wget git curl unzip lsb-release rsync sudo libjemalloc-dev gperf \
10+
uuid-dev && \
1011
rm -rf /var/lib/apt/lists/*
1112

12-
RUN cd /tmp/ && \
13+
RUN cd /tmp && \
1314
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz && \
1415
tar -xzvf Python-2.7.9.tgz && \
1516
cd Python-2.7.9 && \
@@ -21,15 +22,16 @@ RUN cd /tmp/ && \
2122
WORKDIR /usr/src
2223
RUN git clone -c advice.detachedHead=false --recursive https://github.com/apache/incubator-pagespeed-mod.git
2324

24-
COPY ./incubator-pagespeed-mod-aarch64.patch /usr/src/incubator-pagespeed-mod-aarch64.patch
25+
COPY ./incubator-pagespeed-mod-aarch64.patch /usr/src/incubator-pagespeed-mod-aarch64.patch
2526
COPY ./incubator-pagespeed-mod-armv7l.patch /usr/src/incubator-pagespeed-mod-armv7l.patch
2627
COPY ./incubator-pagespeed-mod-x86_64.patch /usr/src/incubator-pagespeed-mod-x86_64.patch
2728

2829
WORKDIR /usr/src/incubator-pagespeed-mod
29-
RUN git reset --hard 409bd76fd6eafc4cf1c414e679f3e912447a6a31
30-
RUN git submodule update --init --recursive --jobs=$(nproc) --force
31-
RUN git reset --soft 2ce278dbbbeeeb6543cf1e970ba47d99726f893a
32-
RUN git show 409bd76fd6eafc4cf1c414e679f3e912447a6a31:.gitmodules > .gitmodules
33-
VOLUME [ "/usr/src" ]
30+
RUN git reset --hard 409bd76fd6eafc4cf1c414e679f3e912447a6a31 && \
31+
git submodule update --init --recursive --jobs=$(nproc) --force && \
32+
git reset --soft 2ce278dbbbeeeb6543cf1e970ba47d99726f893a && \
33+
git show 409bd76fd6eafc4cf1c414e679f3e912447a6a31:.gitmodules > .gitmodules
34+
35+
VOLUME [ "/dist" ]
3436
COPY entrypoint.sh /usr/bin/entrypoint.sh
35-
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
37+
ENTRYPOINT ["/usr/bin/entrypoint.sh"]

entrypoint.sh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ GREEN='\033[0;32m'
66
YELLOW='\033[0;33m'
77
BLUE='\033[0;34m'
88
CYAN='\033[0;36m'
9-
MAGENTA='\033[0;35m'
109
NO_COLOR='\033[0m'
1110

1211
# Define animation frames
@@ -19,32 +18,31 @@ declare -A PATCH_FILES=(
1918
["x86_64"]="/usr/src/incubator-pagespeed-mod-x86_64.patch"
2019
)
2120

22-
# Get current architecture
21+
# Get current architecture and glibc version
2322
ARCH=$(uname -m)
23+
GLIBC_VERSION=$(ldd --version | awk 'NR==1 {print $NF}')
24+
GLIBC_VERSION_NUMBER=$(awk -F. '{print $1 * 100 + $2}' <<< "$GLIBC_VERSION")
2425

2526
# Apply the appropriate patch
2627
PATCH_FILE="${PATCH_FILES[$ARCH]}"
2728
if [[ -n "$PATCH_FILE" ]]; then
28-
echo -e "${CYAN}Applying patch for $ARCH...${NO_COLOR}"
29+
printf "${CYAN}Applying patch for $ARCH...${NO_COLOR}\n"
2930
patch -Np1 -i "$PATCH_FILE"
3031
else
31-
echo -e "${RED}Unsupported architecture: $ARCH${NO_COLOR}"
32+
printf "${RED}Unsupported architecture: $ARCH${NO_COLOR}\n"
3233
exit 1
3334
fi
3435

3536
# Check glibc version and apply sed command if necessary
36-
GLIBC_VERSION=$(ldd --version | awk 'NR==1 {print $NF}')
37-
GLIBC_VERSION_NUMBER=$(echo "$GLIBC_VERSION" | awk -F. '{print $1 * 100 + $2}')
38-
3937
if [[ "$GLIBC_VERSION_NUMBER" -ge 228 ]]; then
40-
echo -e "${CYAN}glibc version $GLIBC_VERSION detected. Applying sed command...${NO_COLOR}"
38+
printf "${CYAN}glibc version $GLIBC_VERSION detected. Applying sed command...${NO_COLOR}\n"
4139
sed -i 's/sys_siglist\[signum\]/strsignal(signum)/g' /usr/src/incubator-pagespeed-mod/third_party/apr/src/threadproc/unix/signals.c
4240
else
43-
echo -e "${YELLOW}glibc version $GLIBC_VERSION detected. No sed command applied.${NO_COLOR}"
41+
printf "${YELLOW}glibc version $GLIBC_VERSION detected. No sed command applied.${NO_COLOR}\n"
4442
fi
4543

4644
# Run the build and installation scripts
47-
echo -e "${GREEN}Running build and installation scripts...${NO_COLOR}"
45+
printf "${GREEN}Running build and installation scripts...${NO_COLOR}\n"
4846
python /usr/src/incubator-pagespeed-mod/build/gyp_chromium --depth=/usr/src/incubator-pagespeed-mod
4947

5048
# Run the build_psol.sh script in the background
@@ -64,17 +62,29 @@ while kill -0 "$BUILD_PID" 2> /dev/null; do
6462
FRAME_INDEX=$(( ELAPSED_TIME / 2 % ${#SPINNER[@]} ))
6563

6664
# Print status with spinner
67-
echo -ne "${YELLOW}Hang tight! ${MAGENTA}Maybe grab a coffee? ${NO_COLOR}Elapsed time: ${BLUE}${ELAPSED_HOURS}h ${ELAPSED_MINUTES}m ${ELAPSED_SECONDS}s ${SPINNER[$FRAME_INDEX]}\r"
65+
printf "${YELLOW}Hang tight! ${NO_COLOR}Elapsed time: ${BLUE}%dh %dm %ds ${SPINNER[$FRAME_INDEX]}\r" \
66+
"$ELAPSED_HOURS" "$ELAPSED_MINUTES" "$ELAPSED_SECONDS"
6867
sleep 0.1 # Shorter sleep time for smoother animation
6968
done
7069

7170
# Clear the line after the spinner stops
72-
echo -ne '\r'
71+
printf '\r'
7372

7473
# Check the exit status of the build process
7574
if wait "$BUILD_PID"; then
76-
echo -e "${GREEN}Build and installation completed successfully.${NO_COLOR}"
75+
printf "${GREEN}Build and installation completed successfully.${NO_COLOR}\n"
76+
tar -xzf psol-1.15.0.0-*.tar.gz
77+
78+
TAR_FILENAME="psol-1.15.0.0-${ARCH}-glibc-${GLIBC_VERSION}.tar.gz"
79+
if [[ -d /usr/src/incubator-pagespeed-mod/psol ]]; then
80+
tar -czf "/dist/$TAR_FILENAME" -C /usr/src/incubator-pagespeed-mod psol
81+
printf "${GREEN}Successfully created and moved $TAR_FILENAME.${NO_COLOR}\n"
82+
else
83+
printf "${RED}Directory /usr/src/incubator-pagespeed-mod/psol not found for compression.${NO_COLOR}\n"
84+
exit 1
85+
fi
86+
printf "${GREEN}Have fun with PAGESPEED.${NO_COLOR}\n"
7787
else
78-
echo -e "${RED}Build and installation failed.${NO_COLOR}"
88+
printf "${RED}Build and installation failed.${NO_COLOR}\n"
7989
exit 1
8090
fi

incubator-pagespeed-mod-aarch64.patch

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,15 +3288,6 @@ diff -Naur incubator-pagespeed-mod.orig/third_party/libwebp/src/dsp/dsp.h incuba
32883288
#define WEBP_NEON_OMIT_C_CODE 0
32893289
#endif
32903290

3291-
From 8850eac347db3a3838c004161683510e4cc3aa26 Mon Sep 17 00:00:00 2001
3292-
From: Lofesa <lofesa@gmail.com>
3293-
Date: Tue, 16 Jul 2019 18:54:40 +0200
3294-
Subject: [PATCH 1/2] Signed-off-by: Lofesa <lofesa@gmail.com>
3295-
3296-
---
3297-
net/instaweb/rewriter/critical_css_loader.js | 7 ++++++-
3298-
1 file changed, 6 insertions(+), 1 deletion(-)
3299-
33003291
diff --git a/net/instaweb/rewriter/critical_css_loader.js b/net/instaweb/rewriter/critical_css_loader.js
33013292
index 0fea1111d7..981a70b8b2 100644
33023293
--- a/net/instaweb/rewriter/critical_css_loader.js
@@ -3318,16 +3309,6 @@ index 0fea1111d7..981a70b8b2 100644
33183309
+ document.body.appendChild(div);
33193310
}
33203311
};
3321-
3322-
3323-
From a1039e17bd33afa3a9f3b0998b8eb1ff16d5259e Mon Sep 17 00:00:00 2001
3324-
From: Lofesa <lofesa@gmail.com>
3325-
Date: Fri, 31 Jul 2020 14:00:30 +0200
3326-
Subject: [PATCH 2/2] Signed-off-by: Lofesa <lofesa@gmail.com>
3327-
3328-
---
3329-
net/instaweb/rewriter/critical_css_loader.js | 2 +-
3330-
1 file changed, 1 insertion(+), 1 deletion(-)
33313312

33323313
diff --git a/net/instaweb/rewriter/critical_css_loader.js b/net/instaweb/rewriter/critical_css_loader.js
33333314
index 981a70b8b2..bdb6fa0862 100644
@@ -3341,20 +3322,6 @@ index 981a70b8b2..bdb6fa0862 100644
33413322
+ document.body.appendChild(div);
33423323
}
33433324
};
3344-
3345-
3346-
From 873bfebc3fc8acd142b322523021849b8b41a45a Mon Sep 17 00:00:00 2001
3347-
From: Lofesa <lofesa@gmail.com>
3348-
Date: Fri, 7 Feb 2020 21:06:59 +0100
3349-
Subject: [PATCH 1/3] Add Firefox UA webp capables and blacklist these taht not
3350-
3351-
Signed-off-by: Lofesa <lofesa@gmail.com>
3352-
---
3353-
pagespeed/kernel/http/user_agent_matcher.cc | 41 +++++++++++++++++++
3354-
.../kernel/http/user_agent_matcher_test.cc | 4 ++
3355-
.../http/user_agent_matcher_test_base.cc | 2 +
3356-
.../http/user_agent_matcher_test_base.h | 1 +
3357-
4 files changed, 48 insertions(+)
33583325

33593326
diff --git a/pagespeed/kernel/http/user_agent_matcher.cc b/pagespeed/kernel/http/user_agent_matcher.cc
33603327
index 62a6364f23..58439f2d68 100644
@@ -3491,18 +3458,6 @@ index f1b146326b..0ca66d0db9 100644
34913458
static const char kFirefoxNokiaN800[];
34923459
static const char kFirefoxUserAgent[];
34933460

3494-
From d6b055e3e490bd66c4ccd32a339b4b5549e743a5 Mon Sep 17 00:00:00 2001
3495-
From: Otto van der Schaaf <oschaaf@we-amp.com>
3496-
Date: Mon, 27 Jul 2020 23:50:21 +0200
3497-
Subject: [PATCH 2/3] Reformat to new specs
3498-
3499-
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
3500-
---
3501-
pagespeed/kernel/http/user_agent_matcher.cc | 119 +++++-------------
3502-
.../kernel/http/user_agent_matcher_test.cc | 24 ++--
3503-
.../http/user_agent_matcher_test_base.cc | 6 +-
3504-
3 files changed, 46 insertions(+), 103 deletions(-)
3505-
35063461
diff --git a/pagespeed/kernel/http/user_agent_matcher.cc b/pagespeed/kernel/http/user_agent_matcher.cc
35073462
index c99df45136..d98fc6c6bd 100644
35083463
--- a/pagespeed/kernel/http/user_agent_matcher.cc

incubator-pagespeed-mod-armv7l.patch

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ diff -Naur incubator-pagespeed-mod.orig/install/build_psol.sh incubator-pagespee
4040
- run_with_log ../../log/psol_automatic_build.log \
4141
- make "${MAKE_ARGS[@]}" MOD_PAGESPEED_ROOT=$mps_root \
4242
- CXXFLAGS="-DSERF_HTTPS_FETCHING=1" all)
43-
+ make -j4 "${MAKE_ARGS[@]}" MOD_PAGESPEED_ROOT=$mps_root \
43+
+ make -j$(nproc) "${MAKE_ARGS[@]}" MOD_PAGESPEED_ROOT=$mps_root \
4444
+ CXXFLAGS="-DSERF_HTTPS_FETCHING=1" CFLAGS="-DPNG_ARM_NEON_OPT=0" all)
4545

4646
version_h=out/$buildtype/obj/gen/net/instaweb/public/version.h
@@ -5700,15 +5700,6 @@ diff -Naur incubator-pagespeed-mod.orig/third_party/libwebp/src/dsp/dsp.h incuba
57005700
#define WEBP_NEON_OMIT_C_CODE 0
57015701
#endif
57025702

5703-
From 8850eac347db3a3838c004161683510e4cc3aa26 Mon Sep 17 00:00:00 2001
5704-
From: Lofesa <lofesa@gmail.com>
5705-
Date: Tue, 16 Jul 2019 18:54:40 +0200
5706-
Subject: [PATCH 1/2] Signed-off-by: Lofesa <lofesa@gmail.com>
5707-
5708-
---
5709-
net/instaweb/rewriter/critical_css_loader.js | 7 ++++++-
5710-
1 file changed, 6 insertions(+), 1 deletion(-)
5711-
57125703
diff --git a/net/instaweb/rewriter/critical_css_loader.js b/net/instaweb/rewriter/critical_css_loader.js
57135704
index 0fea1111d7..981a70b8b2 100644
57145705
--- a/net/instaweb/rewriter/critical_css_loader.js
@@ -5730,16 +5721,6 @@ index 0fea1111d7..981a70b8b2 100644
57305721
+ document.body.appendChild(div);
57315722
}
57325723
};
5733-
5734-
5735-
From a1039e17bd33afa3a9f3b0998b8eb1ff16d5259e Mon Sep 17 00:00:00 2001
5736-
From: Lofesa <lofesa@gmail.com>
5737-
Date: Fri, 31 Jul 2020 14:00:30 +0200
5738-
Subject: [PATCH 2/2] Signed-off-by: Lofesa <lofesa@gmail.com>
5739-
5740-
---
5741-
net/instaweb/rewriter/critical_css_loader.js | 2 +-
5742-
1 file changed, 1 insertion(+), 1 deletion(-)
57435724

57445725
diff --git a/net/instaweb/rewriter/critical_css_loader.js b/net/instaweb/rewriter/critical_css_loader.js
57455726
index 981a70b8b2..bdb6fa0862 100644
@@ -5753,20 +5734,6 @@ index 981a70b8b2..bdb6fa0862 100644
57535734
+ document.body.appendChild(div);
57545735
}
57555736
};
5756-
5757-
5758-
From 873bfebc3fc8acd142b322523021849b8b41a45a Mon Sep 17 00:00:00 2001
5759-
From: Lofesa <lofesa@gmail.com>
5760-
Date: Fri, 7 Feb 2020 21:06:59 +0100
5761-
Subject: [PATCH 1/3] Add Firefox UA webp capables and blacklist these taht not
5762-
5763-
Signed-off-by: Lofesa <lofesa@gmail.com>
5764-
---
5765-
pagespeed/kernel/http/user_agent_matcher.cc | 41 +++++++++++++++++++
5766-
.../kernel/http/user_agent_matcher_test.cc | 4 ++
5767-
.../http/user_agent_matcher_test_base.cc | 2 +
5768-
.../http/user_agent_matcher_test_base.h | 1 +
5769-
4 files changed, 48 insertions(+)
57705737

57715738
diff --git a/pagespeed/kernel/http/user_agent_matcher.cc b/pagespeed/kernel/http/user_agent_matcher.cc
57725739
index 62a6364f23..58439f2d68 100644
@@ -5903,18 +5870,6 @@ index f1b146326b..0ca66d0db9 100644
59035870
static const char kFirefoxNokiaN800[];
59045871
static const char kFirefoxUserAgent[];
59055872

5906-
From d6b055e3e490bd66c4ccd32a339b4b5549e743a5 Mon Sep 17 00:00:00 2001
5907-
From: Otto van der Schaaf <oschaaf@we-amp.com>
5908-
Date: Mon, 27 Jul 2020 23:50:21 +0200
5909-
Subject: [PATCH 2/3] Reformat to new specs
5910-
5911-
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
5912-
---
5913-
pagespeed/kernel/http/user_agent_matcher.cc | 119 +++++-------------
5914-
.../kernel/http/user_agent_matcher_test.cc | 24 ++--
5915-
.../http/user_agent_matcher_test_base.cc | 6 +-
5916-
3 files changed, 46 insertions(+), 103 deletions(-)
5917-
59185873
diff --git a/pagespeed/kernel/http/user_agent_matcher.cc b/pagespeed/kernel/http/user_agent_matcher.cc
59195874
index c99df45136..d98fc6c6bd 100644
59205875
--- a/pagespeed/kernel/http/user_agent_matcher.cc
@@ -6148,4 +6103,3 @@ diff --git a/net/instaweb/genfiles/conf/pagespeed_libraries.conf b/net/instaweb/
61486103
# jquerymobile/1.4.0/jquery.mobile.min.js:
61496104
ModPagespeedLibrary 193066 pkv8dHWLVaOlDGcgh0PYe //ajax.googleapis.com/ajax/libs/jquerymobile/1.4.0/jquery.mobile.min.js
61506105
# jquerymobile/1.4.0/jquery.mobile.js:
6151-

0 commit comments

Comments
 (0)