2023-12-01 02:24:38 +00:00
|
|
|
FROM alpine:3.18.5 as build
|
2017-02-08 07:07:59 +00:00
|
|
|
|
2023-11-20 07:31:38 +00:00
|
|
|
ARG SQUID_VER=6.5
|
2017-05-04 08:09:20 +00:00
|
|
|
|
2017-05-04 10:34:08 +00:00
|
|
|
RUN set -x && \
|
2017-09-22 11:41:21 +00:00
|
|
|
apk add --no-cache \
|
2017-05-04 08:09:20 +00:00
|
|
|
gcc \
|
|
|
|
g++ \
|
|
|
|
libc-dev \
|
|
|
|
curl \
|
|
|
|
gnupg \
|
2023-03-01 11:30:21 +00:00
|
|
|
openssl-dev \
|
2023-02-17 10:21:40 +00:00
|
|
|
openssl-libs-static \
|
2017-05-04 08:09:20 +00:00
|
|
|
perl-dev \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
make \
|
|
|
|
pkgconfig \
|
2017-07-03 10:45:19 +00:00
|
|
|
heimdal-dev \
|
2017-05-04 08:09:20 +00:00
|
|
|
libtool \
|
|
|
|
libcap-dev \
|
2017-09-22 11:41:21 +00:00
|
|
|
linux-headers
|
|
|
|
|
2023-03-01 11:30:21 +00:00
|
|
|
WORKDIR /tmp/build
|
|
|
|
|
2017-09-22 11:41:21 +00:00
|
|
|
RUN set -x && \
|
2023-03-01 11:30:21 +00:00
|
|
|
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz -o squid-${SQUID_VER}.tar.gz && \
|
2018-07-16 11:01:49 +00:00
|
|
|
curl -SsL http://www.squid-cache.org/Versions/v${SQUID_VER%%.*}/squid-${SQUID_VER}.tar.gz.asc -o squid-${SQUID_VER}.tar.gz.asc
|
2021-07-01 11:14:15 +00:00
|
|
|
|
2023-03-01 11:30:21 +00:00
|
|
|
COPY squid-keys.asc /tmp/build
|
2021-07-01 11:14:15 +00:00
|
|
|
|
2017-09-22 11:41:21 +00:00
|
|
|
RUN set -x && \
|
2023-03-01 11:30:21 +00:00
|
|
|
GNUPGHOME="$(mktemp -d)" && \
|
|
|
|
export GNUPGHOME && \
|
|
|
|
gpg --import squid-keys.asc && \
|
2017-05-04 08:09:20 +00:00
|
|
|
gpg --batch --verify squid-${SQUID_VER}.tar.gz.asc squid-${SQUID_VER}.tar.gz && \
|
2017-09-22 11:41:21 +00:00
|
|
|
rm -rf "$GNUPGHOME"
|
2023-03-01 11:30:21 +00:00
|
|
|
|
2017-09-22 11:41:21 +00:00
|
|
|
RUN set -x && \
|
2017-05-04 08:09:20 +00:00
|
|
|
tar --strip 1 -xzf squid-${SQUID_VER}.tar.gz && \
|
2017-09-22 11:41:21 +00:00
|
|
|
\
|
2023-03-01 11:30:21 +00:00
|
|
|
MACHINE=$(uname -m) && \
|
|
|
|
\
|
2017-09-22 11:41:21 +00:00
|
|
|
CFLAGS="-g0 -O2" \
|
|
|
|
CXXFLAGS="-g0 -O2" \
|
|
|
|
LDFLAGS="-s" \
|
|
|
|
\
|
2017-05-04 08:09:20 +00:00
|
|
|
./configure \
|
2023-03-01 11:30:21 +00:00
|
|
|
--build="$MACHINE" \
|
|
|
|
--host="$MACHINE" \
|
2017-05-04 08:09:20 +00:00
|
|
|
--prefix=/usr \
|
|
|
|
--datadir=/usr/share/squid \
|
|
|
|
--sysconfdir=/etc/squid \
|
|
|
|
--libexecdir=/usr/lib/squid \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--with-logdir=/var/log/squid \
|
|
|
|
--disable-strict-error-checking \
|
|
|
|
--disable-arch-native \
|
|
|
|
--enable-removal-policies="lru,heap" \
|
|
|
|
--enable-auth-digest \
|
2023-06-13 10:56:11 +00:00
|
|
|
--enable-auth-basic="getpwnam,NCSA,DB,RADIUS" \
|
2021-12-21 20:30:30 +00:00
|
|
|
--enable-basic-auth-helpers="DB" \
|
2017-05-04 08:09:20 +00:00
|
|
|
--enable-epoll \
|
|
|
|
--enable-external-acl-helpers="file_userip,unix_group,wbinfo_group" \
|
|
|
|
--enable-auth-ntlm="fake" \
|
2020-08-13 11:30:53 +00:00
|
|
|
--enable-auth-negotiate="kerberos,wrapper" \
|
2017-05-04 08:09:20 +00:00
|
|
|
--enable-silent-rules \
|
|
|
|
--disable-mit \
|
2017-07-03 10:45:19 +00:00
|
|
|
--enable-heimdal \
|
2017-05-04 08:09:20 +00:00
|
|
|
--enable-delay-pools \
|
|
|
|
--enable-arp-acl \
|
|
|
|
--enable-openssl \
|
|
|
|
--enable-ssl-crtd \
|
2017-05-16 08:49:14 +00:00
|
|
|
--enable-security-cert-generators="file" \
|
2017-05-04 08:09:20 +00:00
|
|
|
--enable-ident-lookups \
|
|
|
|
--enable-useragent-log \
|
|
|
|
--enable-cache-digests \
|
|
|
|
--enable-referer-log \
|
|
|
|
--enable-async-io \
|
|
|
|
--enable-truncate \
|
|
|
|
--enable-arp-acl \
|
|
|
|
--enable-htcp \
|
|
|
|
--enable-carp \
|
2017-05-04 10:34:08 +00:00
|
|
|
--enable-epoll \
|
2017-05-04 08:09:20 +00:00
|
|
|
--enable-follow-x-forwarded-for \
|
|
|
|
--enable-storeio="diskd rock" \
|
|
|
|
--enable-ipv6 \
|
|
|
|
--enable-translation \
|
2023-09-11 20:07:37 +00:00
|
|
|
--enable-snmp \
|
2017-05-04 08:09:20 +00:00
|
|
|
--disable-dependency-tracking \
|
|
|
|
--with-large-files \
|
|
|
|
--with-default-user=squid \
|
|
|
|
--with-openssl \
|
2017-09-22 11:41:21 +00:00
|
|
|
--with-pidfile=/var/run/squid/squid.pid
|
|
|
|
|
|
|
|
RUN set -x && \
|
2023-03-01 11:30:21 +00:00
|
|
|
nproc=$(n=$(nproc) ; max_n=6 ; echo $(( n <= max_n ? n : max_n )) ) && \
|
2020-08-16 13:34:51 +00:00
|
|
|
make -j $nproc && \
|
2023-03-01 11:30:21 +00:00
|
|
|
make install
|
2020-10-03 13:31:02 +00:00
|
|
|
|
2023-03-01 11:30:21 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
# --- --- --- --- --- --- --- --- ---
|
2017-09-22 11:41:21 +00:00
|
|
|
|
2023-12-01 02:24:38 +00:00
|
|
|
FROM alpine:3.18.5
|
2017-09-22 11:41:21 +00:00
|
|
|
|
|
|
|
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; \
|
|
|
|
addgroup -S squid -g 3128 && adduser -S -u 3128 -G squid -g squid -H -D -s /bin/false -h /var/cache/squid squid
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
libstdc++ \
|
|
|
|
heimdal-libs \
|
|
|
|
libcap \
|
2023-03-01 11:30:21 +00:00
|
|
|
libltdl
|
2017-09-22 11:41:21 +00:00
|
|
|
|
|
|
|
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
|
2020-10-03 13:31:02 +00:00
|
|
|
COPY --from=build /usr/bin/squidclient /usr/bin/squidclient
|
|
|
|
|
2017-09-22 11:41:21 +00:00
|
|
|
RUN install -d -o squid -g squid \
|
2017-05-04 08:09:20 +00:00
|
|
|
/var/cache/squid \
|
|
|
|
/var/log/squid \
|
|
|
|
/var/run/squid && \
|
2023-03-01 11:30:21 +00:00
|
|
|
chmod +x /usr/lib/squid/* && \
|
|
|
|
install -d -m 755 -o squid -g squid \
|
2019-08-11 09:58:17 +00:00
|
|
|
/etc/squid/conf.d \
|
2023-03-01 11:30:21 +00:00
|
|
|
/etc/squid/conf.d.tail && \
|
|
|
|
touch /etc/squid/conf.d/placeholder.conf
|
2019-08-11 09:58:17 +00:00
|
|
|
COPY squid-log.conf /etc/squid/conf.d.tail/
|
2017-09-22 11:41:21 +00:00
|
|
|
|
|
|
|
RUN set -x && \
|
2023-03-01 11:30:21 +00:00
|
|
|
apk add --no-cache --virtual .tz alpine-conf tzdata && \
|
2017-09-22 11:41:21 +00:00
|
|
|
/sbin/setup-timezone -z $TZ && \
|
2023-03-01 11:30:21 +00:00
|
|
|
apk del .tz
|
|
|
|
|
|
|
|
VOLUME ["/var/cache/squid"]
|
2017-02-08 07:07:59 +00:00
|
|
|
EXPOSE 3128/tcp
|
2017-02-08 07:42:55 +00:00
|
|
|
|
2017-05-04 08:09:20 +00:00
|
|
|
USER squid
|
|
|
|
|
2023-07-07 06:09:42 +00:00
|
|
|
CMD ["sh", "-c", "rm -f /var/run/squid/squid.pid ; /usr/sbin/squid -f ${SQUID_CONFIG_FILE} --foreground -z && exec /usr/sbin/squid -f ${SQUID_CONFIG_FILE} --foreground -YCd 1"]
|