mirror of
https://github.com/b4tman/docker-squid.git
synced 2026-07-27 10:42:54 +03:00
Compare commits
4 Commits
9d1249ebcf
...
v7.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| b8df13a7d6 | |||
| 35953b314c | |||
| 54797967b9 | |||
| 07d9abcbe6 |
+6
-8
@@ -1,6 +1,6 @@
|
|||||||
FROM alpine:3.23.3 as build
|
FROM alpine:3.23.3 AS build
|
||||||
|
|
||||||
ARG SQUID_VER=6.13
|
ARG SQUID_VER=7.4
|
||||||
|
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
@@ -98,9 +98,6 @@ RUN set -x && \
|
|||||||
make -j $nproc && \
|
make -j $nproc && \
|
||||||
make install
|
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 && \
|
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
|
echo 'include /etc/squid/conf.d.tail/*.conf' >> /etc/squid/squid.conf
|
||||||
|
|
||||||
@@ -108,8 +105,8 @@ RUN sed -i '1s;^;include /etc/squid/conf.d/*.conf\n;' /etc/squid/squid.conf && \
|
|||||||
|
|
||||||
FROM alpine:3.23.3
|
FROM alpine:3.23.3
|
||||||
|
|
||||||
ENV SQUID_CONFIG_FILE /etc/squid/squid.conf
|
ENV SQUID_CONFIG_FILE=/etc/squid/squid.conf
|
||||||
ENV TZ Europe/Moscow
|
ENV TZ=Europe/Moscow
|
||||||
|
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
deluser squid 2>/dev/null; delgroup squid 2>/dev/null; \
|
deluser squid 2>/dev/null; delgroup squid 2>/dev/null; \
|
||||||
@@ -120,13 +117,14 @@ RUN apk add --no-cache \
|
|||||||
heimdal-libs \
|
heimdal-libs \
|
||||||
libcap \
|
libcap \
|
||||||
libltdl \
|
libltdl \
|
||||||
|
apache2-utils \
|
||||||
|
curl \
|
||||||
tzdata
|
tzdata
|
||||||
|
|
||||||
COPY --from=build /etc/squid/ /etc/squid/
|
COPY --from=build /etc/squid/ /etc/squid/
|
||||||
COPY --from=build /usr/lib/squid/ /usr/lib/squid/
|
COPY --from=build /usr/lib/squid/ /usr/lib/squid/
|
||||||
COPY --from=build /usr/share/squid/ /usr/share/squid/
|
COPY --from=build /usr/share/squid/ /usr/share/squid/
|
||||||
COPY --from=build /usr/sbin/squid /usr/sbin/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 /
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,19 @@ docker-compose up
|
|||||||
|
|
||||||
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.
|
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:
|
## Environment variables:
|
||||||
|
|
||||||
- **SQUID_CONFIG_FILE**: Specify the configuration file for squid. Defaults to `/etc/squid/squid.conf`.
|
- **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:
|
## Example:
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
version: '2.3'
|
|
||||||
services:
|
services:
|
||||||
proxy:
|
proxy:
|
||||||
image: "${TEST_TAG}"
|
image: "${TEST_TAG}"
|
||||||
healthcheck:
|
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
|
interval: 5s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -14,5 +13,4 @@ services:
|
|||||||
- proxy
|
- proxy
|
||||||
depends_on:
|
depends_on:
|
||||||
- proxy
|
- 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:
|
services:
|
||||||
squid:
|
squid:
|
||||||
image: 'b4tman/squid'
|
image: 'b4tman/squid'
|
||||||
|
|||||||
Reference in New Issue
Block a user