1
0
mirror of https://github.com/b4tman/docker-squid.git synced 2026-07-27 10:42:54 +03:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Dmitry Belyaev b8df13a7d6 Fix Dockerfile and Compose deprecation warnings 2026-03-05 14:23:55 +03:00
Dmitry Belyaev 35953b314c Update README configuration options 2026-03-05 13:56:44 +03:00
Dmitry Belyaev 54797967b9 Update Squid to 7.4 and replace squidclient with curl 2026-03-04 13:07:25 +03:00
Dmitry Belyaev 07d9abcbe6 Add apache2-utils package for auth tooling 2026-03-04 11:07:58 +03:00
Dmitry Belyaev 9d1249ebcf Enable localnet ACL by default in base image 2026-03-03 13:26:09 +03:00
dependabot[bot] b29bf01bef Bump alpine from 3.23.2 to 3.23.3
Bumps alpine from 3.23.2 to 3.23.3.

---
updated-dependencies:
- dependency-name: alpine
  dependency-version: 3.23.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-01 13:34:48 +03:00
dependabot[bot] d3b6a7ea22 Bump actions/cache from 5.0.1 to 5.0.3
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.1 to 5.0.3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v5.0.1...v5.0.3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-01 13:04:19 +03:00
6 changed files with 37 additions and 31 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v5.0.1
uses: actions/cache@v5.0.3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -153,7 +153,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v5.0.1
uses: actions/cache@v5.0.3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
+10 -11
View File
@@ -1,6 +1,6 @@
FROM alpine:3.23.2 as build
FROM alpine:3.23.3 AS build
ARG SQUID_VER=6.13
ARG SQUID_VER=7.4
RUN set -x && \
apk add --no-cache \
@@ -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.23.2
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"]
+12
View File
@@ -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:
+2 -6
View File
@@ -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
View File
@@ -1,4 +1,3 @@
version: '2'
services:
squid:
image: 'b4tman/squid'
+11 -11
View File
@@ -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