Update 2 files

- /squid/run.sh
- /Dockerfile
This commit is contained in:
Fred 2024-04-18 11:55:18 +00:00
parent 14160ad2d4
commit 633d4e1d09
2 changed files with 13 additions and 10 deletions

View File

@ -13,8 +13,8 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--program-prefix= \ --program-prefix= \
--libdir=/usr/lib \ --libdir=/usr/lib \
--libexecdir=/usr/lib/squid \ --libexecdir=/usr/lib/squid \
--localstatedir=/var \ --localstatedir=/run \
--sharedstatedir=/usr/com \ --sharedstatedir=/var/lib \
--mandir=/usr/share/man \ --mandir=/usr/share/man \
--infodir=/usr/share/info \ --infodir=/usr/share/info \
--enable-icap-client \ --enable-icap-client \
@ -38,7 +38,7 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--enable-ssl \ --enable-ssl \
--enable-ssl-crtd \ --enable-ssl-crtd \
--with-openssl \ --with-openssl \
--enable-storeio="aufs,diskd,ufs" \ --enable-storeio="aufs,diskd,ufs,rock" \
--exec-prefix=/usr \ --exec-prefix=/usr \
--enable-auth-basic="LDAP" \ --enable-auth-basic="LDAP" \
--enable-auth-digest="LDAP" \ --enable-auth-digest="LDAP" \
@ -51,7 +51,7 @@ RUN echo "deb-src http://deb.debian.org/debian bookworm main contrib" >> /etc/ap
--with-filedescriptors=48000 \ --with-filedescriptors=48000 \
--enable-delay-pools \ --enable-delay-pools \
--with-large-files \ --with-large-files \
--with-pidfile=/squid/squid.pid \ --with-pidfile=/run/squid.pid \
--with-default-user=squid \ --with-default-user=squid \
--enable-removal-policies="lru,heap" \ --enable-removal-policies="lru,heap" \
&& make \ && make \
@ -98,6 +98,7 @@ RUN adduser --no-create-home --uid 1161 --group --system squid \
&& echo "access_log stdio:/var/log/squid/access.log" >> /etc/squid/squid.conf \ && echo "access_log stdio:/var/log/squid/access.log" >> /etc/squid/squid.conf \
&& echo "cache_log /var/log/squid/cache.log" >> /etc/squid/squid.conf \ && echo "cache_log /var/log/squid/cache.log" >> /etc/squid/squid.conf \
&& echo "cache_effective_user squid" >> /etc/squid/squid.conf \ && echo "cache_effective_user squid" >> /etc/squid/squid.conf \
&& echo "pid_filename /run/squid.pid" >> /etc/squid/squid.conf \
# Removed in 5.8, needed for test # Removed in 5.8, needed for test
&& sed -i '/http_access deny all/ihttp_access allow localnet' /etc/squid/squid.conf \ && sed -i '/http_access deny all/ihttp_access allow localnet' /etc/squid/squid.conf \
# Packages dependencies installation for running and clean again # Packages dependencies installation for running and clean again
@ -110,4 +111,4 @@ HEALTHCHECK CMD squidclient mgr:info | grep "HTTP/1.1 200 OK" || exit 1
EXPOSE 3128 EXPOSE 3128
ENTRYPOINT ["dumb-init"] ENTRYPOINT ["dumb-init"]
USER squid USER squid
CMD ["bash", "-c", "/squid/run.sh && squid -N -n $HOSTNAME"] CMD ["bash", "-c", "/squid/run.sh"]

View File

@ -1,8 +1,10 @@
#!/bin/bash #!/bin/bash
USER=$( grep -m 1 ^cache_effective_user /etc/squid/squid.conf | awk '{ print ($2) }' )
if [ -e "/squid/squid.pid" ];then PID=$( grep -m 1 ^pid_filename /etc/squid/squid.conf | awk '{ print ($2) }' )
]
if [ -e "$PID" ];then
echo "Squid pid: Already running ?" echo "Squid pid: Already running ?"
rm /squid/squid.pid rm $PÏD
pkill squid pkill squid
exit 1 exit 1
fi fi
@ -17,7 +19,7 @@ else
touch "/var/spool/squid/$HOSTNAME" touch "/var/spool/squid/$HOSTNAME"
fi fi
while test -e /tmp/$HOSTNAME.pid while test -e $PID
do do
echo "cache is generated/checked" echo "cache is generated/checked"
sleep 1 sleep 1
@ -42,4 +44,4 @@ fi
echo "Starting: squid" echo "Starting: squid"
# Run autoreload: IN BACKGROUND # Run autoreload: IN BACKGROUND
/squid/autoreload.sh & /squid/autoreload.sh &
squid --foreground -N -n "$HOSTNAME"