mirror of
https://github.com/b4tman/docker-squid.git
synced 2026-05-26 22:16:12 +03:00
Compare commits
42 Commits
v6.9.0
..
38b02d14fd
| Author | SHA1 | Date | |
|---|---|---|---|
| 38b02d14fd | |||
| 04e457ba53 | |||
| b1ca8a345b | |||
| 2163ad1e6b | |||
| 9c7cd164d8 | |||
| 8a78e188ec | |||
| d365d6da53 | |||
| b8df13a7d6 | |||
| 35953b314c | |||
| 54797967b9 | |||
| 07d9abcbe6 | |||
| 9d1249ebcf | |||
| b29bf01bef | |||
| d3b6a7ea22 | |||
| 4f1b8ed939 | |||
| e783f185b9 | |||
| 4913c55528 | |||
| 5554d165ea | |||
| 3ca2b8926d | |||
| f6b90099d2 | |||
| 24e1818526 | |||
| c74c051f12 | |||
| 2a3391c562 | |||
| 1b1aede330 | |||
| d39bf7f8b6 | |||
| bc1e2c287d | |||
|
8723ca0ca8
|
|||
| 89f53c9af2 | |||
| 883a36790a | |||
| 3ff6520eeb | |||
| 3877c77b6f | |||
| eb2cea4f44 | |||
| 39e61037cb | |||
| 1e431e392b | |||
| c75d1354aa | |||
| 000a827460 | |||
| 8dab59fee5 | |||
| 8669f6e1d5 | |||
| 0978b18b73 | |||
| 63cf1fc739 | |||
| 9aec6fae6a | |||
| 75b290de69 |
@@ -0,0 +1 @@
|
||||
custom: ['https://dalink.to/b4tman1', 'https://boosty.to/0xffff']
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
push:
|
||||
# Publish `master` as Docker `latest` image.
|
||||
branches:
|
||||
- master
|
||||
- master
|
||||
- v5
|
||||
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
@@ -21,15 +21,15 @@ env:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4.0.2
|
||||
uses: actions/cache@v5.0.4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Build squid image
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
sed -i "s%FROM b4tman/squid%FROM $TEST_TAG%" ssl-bump/Dockerfile
|
||||
|
||||
- name: Build 'ssl-bump' image
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
@@ -99,14 +99,14 @@ jobs:
|
||||
docker compose -f docker-compose.test.yml down
|
||||
push:
|
||||
needs: test
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: |
|
||||
b4tman/squid
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
|
||||
- name: Docker meta (ssl-bump)
|
||||
id: meta_ssl_bump
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: |
|
||||
b4tman/squid
|
||||
@@ -135,7 +135,7 @@ jobs:
|
||||
|
||||
- name: Docker meta (ssl-bump ghcr)
|
||||
id: meta_ssl_bump_ghcr
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/b4tman/squid-ssl-bump
|
||||
@@ -147,13 +147,13 @@ jobs:
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4.0.2
|
||||
uses: actions/cache@v5.0.4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
@@ -174,7 +174,7 @@ jobs:
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Build squid image
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Build 'ssl-bump' image
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: ssl-bump
|
||||
push: true
|
||||
@@ -213,7 +213,7 @@ jobs:
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
|
||||
- name: Build 'ssl-bump' image for ghcr
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: ssl-bump
|
||||
push: true
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
days-before-stale: 182
|
||||
days-before-close: 7
|
||||
|
||||
+12
-13
@@ -1,6 +1,6 @@
|
||||
FROM alpine:3.19.1 as build
|
||||
FROM alpine:3.23.3 AS build
|
||||
|
||||
ARG SQUID_VER=6.9
|
||||
ARG SQUID_VER=7.5
|
||||
|
||||
RUN set -x && \
|
||||
apk add --no-cache \
|
||||
@@ -24,8 +24,8 @@ RUN set -x && \
|
||||
WORKDIR /tmp/build
|
||||
|
||||
RUN set -x && \
|
||||
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz -o squid-${SQUID_VER}.tar.gz && \
|
||||
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz.asc -o squid-${SQUID_VER}.tar.gz.asc
|
||||
curl -fSsL "https://github.com/squid-cache/squid/releases/download/SQUID_${SQUID_VER//./_}/squid-${SQUID_VER}.tar.gz" -o squid-${SQUID_VER}.tar.gz && \
|
||||
curl -fSsL "https://github.com/squid-cache/squid/releases/download/SQUID_${SQUID_VER//./_}/squid-${SQUID_VER}.tar.gz.asc" -o squid-${SQUID_VER}.tar.gz.asc
|
||||
|
||||
COPY squid-keys.asc /tmp/build
|
||||
|
||||
@@ -98,18 +98,15 @@ RUN set -x && \
|
||||
make -j $nproc && \
|
||||
make install
|
||||
|
||||
WORKDIR /tmp/build/tools/squidclient
|
||||
RUN make && make install-strip
|
||||
|
||||
RUN sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf && \
|
||||
echo 'include /etc/squid/conf.d.tail/*.conf' >> /etc/squid/squid.conf
|
||||
|
||||
# --- --- --- --- --- --- --- --- ---
|
||||
|
||||
FROM alpine:3.19.1
|
||||
FROM alpine:3.23.3
|
||||
|
||||
ENV SQUID_CONFIG_FILE /etc/squid/squid.conf
|
||||
ENV TZ Europe/Moscow
|
||||
ENV SQUID_CONFIG_FILE=/etc/squid/squid.conf
|
||||
ENV TZ=Europe/Moscow
|
||||
|
||||
RUN set -x && \
|
||||
deluser squid 2>/dev/null; delgroup squid 2>/dev/null; \
|
||||
@@ -120,15 +117,16 @@ RUN apk add --no-cache \
|
||||
heimdal-libs \
|
||||
libcap \
|
||||
libltdl \
|
||||
apache2-utils \
|
||||
curl \
|
||||
tzdata
|
||||
|
||||
COPY --from=build /etc/squid/ /etc/squid/
|
||||
COPY --from=build /usr/lib/squid/ /usr/lib/squid/
|
||||
COPY --from=build /usr/share/squid/ /usr/share/squid/
|
||||
COPY --from=build /usr/sbin/squid /usr/sbin/squid
|
||||
COPY --from=build /usr/bin/squidclient /usr/bin/squidclient
|
||||
|
||||
COPY --chmod=755 run.sh /
|
||||
|
||||
COPY --chmod=755 run.sh /
|
||||
|
||||
RUN install -d -o squid -g squid \
|
||||
/var/cache/squid \
|
||||
@@ -139,6 +137,7 @@ RUN install -d -o squid -g squid \
|
||||
/etc/squid/conf.d \
|
||||
/etc/squid/conf.d.tail && \
|
||||
touch /etc/squid/conf.d/placeholder.conf
|
||||
COPY localnet.conf /etc/squid/conf.d/
|
||||
COPY squid-log.conf /etc/squid/conf.d.tail/
|
||||
|
||||
VOLUME ["/var/cache/squid"]
|
||||
|
||||
@@ -30,9 +30,21 @@ docker-compose up
|
||||
|
||||
# Configuration
|
||||
|
||||
By default, the image now includes a local network allow-list (`/etc/squid/conf.d/localnet.conf`) so clients from RFC1918/RFC4193 ranges can connect without mounting an extra ACL file.
|
||||
|
||||
The image also includes `apache2-utils`, so you can generate and manage `htpasswd` files directly in the container for basic authentication setups.
|
||||
|
||||
|
||||
## Environment variables:
|
||||
|
||||
- **SQUID_CONFIG_FILE**: Specify the configuration file for squid. Defaults to `/etc/squid/squid.conf`.
|
||||
- **TZ**: Override the container timezone (for example, `Europe/Berlin`).
|
||||
|
||||
You can configure Squid in multiple ways:
|
||||
|
||||
- Replace the main configuration file by overriding `SQUID_CONFIG_FILE`.
|
||||
- Add configuration snippets to `/etc/squid/conf.d`: all `*.conf` files from this directory are included at the **beginning** of the default configuration.
|
||||
- Add configuration snippets to `/etc/squid/conf.d.tail`: all `*.conf` files from this directory are included at the **end** of the default configuration.
|
||||
|
||||
## Example:
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
version: '2.3'
|
||||
services:
|
||||
proxy:
|
||||
image: "${TEST_TAG}"
|
||||
volumes:
|
||||
- './test_localnet.conf:/etc/squid/conf.d/test_localnet.conf:ro'
|
||||
healthcheck:
|
||||
test: ["CMD", "sh", "-exc", "squidclient -T 3 mgr:info 2> /dev/null | grep -qF '200 OK'"]
|
||||
test: ["CMD", "sh", "-exc", "curl -s -o /dev/null --max-time 3 -w '%{http_code}' 'http://127.0.0.1:3128/squid-internal-mgr/info' 2> /dev/null | grep -qF '200'"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
@@ -16,5 +13,4 @@ services:
|
||||
- proxy
|
||||
depends_on:
|
||||
- proxy
|
||||
command: sh -exc "sleep 10 && squidclient -h proxy -T 3 'https://postman-echo.com/get?squidtest=ok' 2> /dev/null | grep -qF '200 OK'"
|
||||
|
||||
command: sh -exc "sleep 10 && curl --proxy='http://proxy:3128' -s -o /dev/null --max-time 3 -w '%{http_code}' 'https://postman-echo.com/get?squidtest=ok' 2> /dev/null | grep -qF '200'"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
version: '2'
|
||||
services:
|
||||
squid:
|
||||
image: 'b4tman/squid'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
acl localnet1 src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
|
||||
acl localnet1 src 10.0.0.0/8 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
|
||||
acl localnet1 src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
|
||||
acl localnet1 src 172.16.0.0/12 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src 192.168.0.0/16 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src fc00::/7 # RFC 4193 local private network range
|
||||
acl localnet1 src fe80::/10 # RFC 4291 link-local (directly plugged) machines
|
||||
|
||||
http_access allow localnet1
|
||||
http_access allow localhost manager
|
||||
acl localnet1 src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
|
||||
acl localnet1 src 10.0.0.0/8 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
|
||||
acl localnet1 src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
|
||||
acl localnet1 src 172.16.0.0/12 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src 192.168.0.0/16 # RFC 1918 local private network (LAN)
|
||||
acl localnet1 src fc00::/7 # RFC 4193 local private network range
|
||||
acl localnet1 src fe80::/10 # RFC 4291 link-local (directly plugged) machines
|
||||
|
||||
http_access allow localnet1
|
||||
http_access allow localhost manager
|
||||
@@ -7,6 +7,11 @@ if [ ! -d /var/cache/squid/ssl_db ]; then
|
||||
/usr/lib/squid/security_file_certgen -c -s /var/cache/squid/ssl_db -M 4MB
|
||||
fi
|
||||
|
||||
# force remove pid
|
||||
if [ -e /var/run/squid/squid.pid ]; then
|
||||
rm -f /var/run/squid/squid.pid
|
||||
fi
|
||||
|
||||
# init cache
|
||||
/usr/sbin/squid -f "${SQUID_CONFIG_FILE}" --foreground -z
|
||||
|
||||
|
||||
Reference in New Issue
Block a user