Skip to content

Commit 4ebeed4

Browse files
committed
build: add patch application system for squid versions
Adds a patch directory and version-specific patch application logic to the Dockerfile build process. The system automatically detects and applies patches from version-specific directories (vX) when available, skipping silently when no patches exist for the current major version.
1 parent 147d9d1 commit 4ebeed4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ RUN shopt -s extglob && \
3131
curl -L "https://github.com/squid-cache/squid/releases/download/SQUID_${SQUID_VERSION_CURL//./_}/squid-${SQUID_VERSION_CURL}.tar.gz" \
3232
| tar -xzf - --strip-components=1
3333

34+
COPY patch /src/patch/
35+
36+
RUN SQUID_MAJOR_VERSION="${SQUID_VERSION%%.*}" && \
37+
PATCH_DIR="/src/patch/v${SQUID_MAJOR_VERSION}" && \
38+
if [[ -d "$PATCH_DIR" ]]; then \
39+
echo "Applying patches from $PATCH_DIR" && \
40+
shopt -s nullglob && \
41+
for patch_file in "$PATCH_DIR"/*.patch; do \
42+
echo "Applying patch: $(basename "$patch_file")" \
43+
&& patch -p1 --verbose --forward --batch < "$patch_file" || { echo "Failed to apply patch: $(basename "$patch_file")"; exit 1; }; \
44+
done; \
45+
else \
46+
echo "No version-specific patches found for v${SQUID_MAJOR_VERSION} (missing $PATCH_DIR). Skipping."; \
47+
fi
48+
49+
3450
FROM start AS builder
3551

3652
RUN export PKG_CONFIG="pkg-config --static" && \

0 commit comments

Comments
 (0)